You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/02/28 12:29:52 UTC

[01/20] lucenenet git commit: SWEEP: Added missing SuppressCodecs attributes solution-wide

Repository: lucenenet
Updated Branches:
  refs/heads/api-work 03d03a939 -> 2ddcc94bf


SWEEP: Added missing SuppressCodecs attributes solution-wide


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

Branch: refs/heads/api-work
Commit: 3527406b9df344f67dd569d3226e7cb52b9e2c56
Parents: 03d03a9
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Mon Feb 27 17:32:23 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Mon Feb 27 17:32:23 2017 +0700

----------------------------------------------------------------------
 .../Analysis/Core/TestBugInSomething.cs                         | 3 ++-
 .../Collation/TestCollationKeyAnalyzer.cs                       | 1 +
 .../SimpleNaiveBayesClassifierTest.cs                           | 3 +--
 src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs         | 5 +++--
 src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs      | 1 +
 src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs         | 1 +
 src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs   | 1 +
 src/Lucene.Net.Tests.Facet/FacetTestCase.cs                     | 1 +
 src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs     | 2 +-
 src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs        | 1 +
 src/Lucene.Net.Tests.Misc/Index/Sorter/TestBlockJoinSorter.cs   | 1 +
 src/Lucene.Net.Tests.Misc/Index/Sorter/TestEarlyTermination.cs  | 1 +
 .../Index/Sorter/TestSortingMergePolicy.cs                      | 3 ++-
 src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs             | 1 +
 .../Function/TestDocValuesFieldSources.cs                       | 2 +-
 .../Function/TestLongNormValueSource.cs                         | 2 +-
 .../Analyzing/TestAnalyzingQueryParser.cs                       | 1 +
 .../Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs            | 2 +-
 .../Suggest/Analyzing/TestFreeTextSuggester.cs                  | 3 ++-
 src/Lucene.Net.Tests.Suggest/Suggest/DocumentDictionaryTest.cs  | 1 +
 .../Suggest/DocumentValueSourceDictionaryTest.cs                | 1 +
 21 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
index 5a08ec4..ed4580b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
@@ -29,7 +29,8 @@ namespace Lucene.Net.Analysis.Core
 	 * See the License for the specific language governing permissions and
 	 * limitations under the License.
 	 */
-
+    
+    [SuppressCodecs("Direct")]
     public class TestBugInSomething : BaseTokenStreamTestCase
     {
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
index 49a8782..6af17e1 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
@@ -26,6 +26,7 @@ namespace Lucene.Net.Collation
      * limitations under the License.
      */
 
+    [SuppressCodecs("Lucene3x")]
     [TestFixture]
 	public class TestCollationKeyAnalyzer : CollationTestBase
 	{

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs b/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
index 077554c..0af9673 100644
--- a/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
+++ b/src/Lucene.Net.Tests.Classification/SimpleNaiveBayesClassifierTest.cs
@@ -31,8 +31,7 @@ namespace Lucene.Net.Classification
      * Testcase for {@link SimpleNaiveBayesClassifier}
      */
     // TODO : eventually remove this if / when fallback methods exist for all un-supportable codec methods (see LUCENE-4872)
-    // [Util.LuceneTestCase.SuppressCodecs("Lucene3x")] TODO : seems like we lost ability to pass in params in SupressCodecs constructor
-    [SuppressCodecs]
+    [SuppressCodecs("Lucene3x")]
     public class SimpleNaiveBayesClassifierTest : ClassificationTestBase<BytesRef>
     {
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs b/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
index 4d6a51a..bbe4260 100644
--- a/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
@@ -11,8 +11,9 @@ using Expression = System.Linq.Expressions.Expression;
 
 namespace Lucene.Net.Tests.Expressions
 {
-	/// <summary>simple demo of using expressions</summary>
-	public class TestDemoExpressions : Util.LuceneTestCase
+    /// <summary>simple demo of using expressions</summary>
+    [SuppressCodecs("Lucene3x")]
+    public class TestDemoExpressions : Util.LuceneTestCase
 	{
 		internal IndexSearcher searcher;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
index 1899640..ae8943a 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
@@ -8,6 +8,7 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Tests.Expressions
 {
+    [SuppressCodecs("Lucene3x")]
 	public class TestExpressionRescorer : Lucene.Net.Util.LuceneTestCase
 	{
 		internal IndexSearcher searcher;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
index 4852778..563db40 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
@@ -19,6 +19,7 @@ namespace Lucene.Net.Tests.Expressions
     /// Tests some basic expressions against different queries,
     /// and fieldcache/docvalues fields against an equivalent sort.
     /// </remarks>
+    [SuppressCodecs("Lucene3x")]
     public class TestExpressionSorts : Util.LuceneTestCase
     {
         private Directory dir;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
index cc1b9b4..5ccd24c 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
@@ -11,6 +11,7 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Tests.Expressions
 {
+    [SuppressCodecs("Lucene3x")]
 	public class TestExpressionValueSource : Util.LuceneTestCase
 	{
 		internal DirectoryReader reader;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
index 3a44c89..849f32a 100644
--- a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
+++ b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
@@ -39,6 +39,7 @@ namespace Lucene.Net.Facet
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
     using TestUtil = Lucene.Net.Util.TestUtil;
 
+    [SuppressCodecs("Lucene3x")]
     [TestFixture]
     public abstract class FacetTestCase : LuceneTestCase
     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
index 9ce09d0..4e4b164 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
@@ -36,7 +36,7 @@ namespace Lucene.Net.Facet.Taxonomy
 
 
     [TestFixture]
-    [SuppressCodecs]
+    [SuppressCodecs("SimpleText", "Lucene3x")]
     public class TestTaxonomyCombined : FacetTestCase
     {
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
index a364e45..9e2ad28 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
@@ -31,6 +31,7 @@ namespace Lucene.Net.Index.Sorter
      * limitations under the License.
      */
 
+    [SuppressCodecs("Lucene3x")]
     public abstract class SorterTestBase : LuceneTestCase
     {
         internal class NormsSimilarity : Similarity

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestBlockJoinSorter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/TestBlockJoinSorter.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestBlockJoinSorter.cs
index 5608827..8ecb6cd 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/TestBlockJoinSorter.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestBlockJoinSorter.cs
@@ -11,6 +11,7 @@ using Lucene.Net.Documents;
 
 namespace Lucene.Net.Index.Sorter
 {
+    [SuppressCodecs("Lucene3x")]
     public class TestBlockJoinSorter : LuceneTestCase
     {
         private class FixedBitSetCachingWrapperFilter : CachingWrapperFilter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestEarlyTermination.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/TestEarlyTermination.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestEarlyTermination.cs
index 077d200..5efd41e 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/TestEarlyTermination.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestEarlyTermination.cs
@@ -27,6 +27,7 @@ namespace Lucene.Net.Index.Sorter
      * limitations under the License.
      */
 
+    [SuppressCodecs("Lucene3x")]
     public class TestEarlyTermination : LuceneTestCase
     {
         private int numDocs;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestSortingMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/TestSortingMergePolicy.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestSortingMergePolicy.cs
index f429546..dd6a1ba 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/TestSortingMergePolicy.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/TestSortingMergePolicy.cs
@@ -26,7 +26,8 @@ namespace Lucene.Net.Index.Sorter
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
-
+    
+    [SuppressCodecs("Lucene3x")]
     public class TestSortingMergePolicy : LuceneTestCase
     {
         private List<string> terms;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
index c579077..5b27e86 100644
--- a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
+++ b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
@@ -8,6 +8,7 @@ using System;
 
 namespace Lucene.Net.Misc
 {
+    [SuppressCodecs("Lucene3x")]
     public class TestHighFreqTerms : LuceneTestCase
     {
         private static IndexWriter writer = null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs b/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
index fab9d0d..3dce56f 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
@@ -14,7 +14,7 @@ using System.Globalization;
 
 namespace Lucene.Net.Tests.Queries.Function
 {
-    // [Util.LuceneTestCase.SuppressCodecs("Lucene3x")]
+    [SuppressCodecs("Lucene3x")]
     public class TestDocValuesFieldSources : LuceneTestCase
     {
         private void DoTest(DocValuesType type)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs b/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
index a8e13c8..f459872 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
@@ -12,7 +12,7 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Tests.Queries.Function
 {
-    // [Util.LuceneTestCase.SuppressCodecs("Lucene3x")]
+    [SuppressCodecs("Lucene3x")]
     public class TestLongNormValueSource : LuceneTestCase
     {
         internal static Directory dir;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.QueryParser/Analyzing/TestAnalyzingQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Analyzing/TestAnalyzingQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Analyzing/TestAnalyzingQueryParser.cs
index 85c6a55..321d910 100644
--- a/src/Lucene.Net.Tests.QueryParser/Analyzing/TestAnalyzingQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Analyzing/TestAnalyzingQueryParser.cs
@@ -32,6 +32,7 @@ namespace Lucene.Net.QueryParsers.Analyzing
      * limitations under the License.
      */
 
+    [SuppressCodecs("Lucene3x")] // binary terms
     [TestFixture]
     public class TestAnalyzingQueryParser : LuceneTestCase
     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
index 0143911..e1c6b31 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs
@@ -36,7 +36,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
 
 
     // Test requires postings offsets:
-    //@SuppressCodecs({ "Lucene3x","MockFixedIntBlock","MockVariableIntBlock","MockSep","MockRandom"})
+    [SuppressCodecs("Lucene3x", "MockFixedIntBlock", "MockVariableIntBlock", "MockSep", "MockRandom")]
     public class AnalyzingInfixSuggesterTest : LuceneTestCase
     {
         public void TestBasic()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
index 64b7511..23da8d4 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
@@ -12,7 +12,7 @@ using System.Globalization;
 using System.IO;
 using System.Text;
 
-//@SuppressCodecs("Lucene3x")
+
 namespace Lucene.Net.Search.Suggest.Analyzing
 {
     /*
@@ -32,6 +32,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
      * limitations under the License.
      */
 
+    [SuppressCodecs("Lucene3x")]
     public class TestFreeTextSuggester : LuceneTestCase
     {
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Suggest/Suggest/DocumentDictionaryTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/DocumentDictionaryTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/DocumentDictionaryTest.cs
index cea8347..2bbc3b6 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/DocumentDictionaryTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/DocumentDictionaryTest.cs
@@ -29,6 +29,7 @@ namespace Lucene.Net.Search.Suggest
      * limitations under the License.
      */
 
+    [SuppressCodecs("Lucene3x")]
     public class DocumentDictionaryTest : LuceneTestCase
     {
         internal static readonly string FIELD_NAME = "f1";

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3527406b/src/Lucene.Net.Tests.Suggest/Suggest/DocumentValueSourceDictionaryTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/DocumentValueSourceDictionaryTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/DocumentValueSourceDictionaryTest.cs
index 6508dc6..78a4f35 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/DocumentValueSourceDictionaryTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/DocumentValueSourceDictionaryTest.cs
@@ -31,6 +31,7 @@ namespace Lucene.Net.Search.Suggest
      * limitations under the License.
      */
 
+    [SuppressCodecs("Lucene3x")]
     public class DocumentValueSourceDictionaryTest : LuceneTestCase
     {
         static readonly string FIELD_NAME = "f1";


[04/20] lucenenet git commit: Lucene.Net.TestFramework: Implemented CheapBastardCodec

Posted by ni...@apache.org.
Lucene.Net.TestFramework: Implemented CheapBastardCodec


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

Branch: refs/heads/api-work
Commit: 4e4d17c1a5e00b833379298c43d2f3ed41eb4aa8
Parents: 28efcab
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Mon Feb 27 23:40:51 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Mon Feb 27 23:40:51 2017 +0700

----------------------------------------------------------------------
 .../Codecs/CheapBastard/CheapBastardCodec.cs    | 54 ++++++++++++++++++++
 .../Lucene.Net.TestFramework.csproj             |  1 +
 .../Util/TestRuleSetupAndRestoreClassEnv.cs     | 12 ++---
 3 files changed, 61 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e4d17c1/src/Lucene.Net.TestFramework/Codecs/CheapBastard/CheapBastardCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/CheapBastard/CheapBastardCodec.cs b/src/Lucene.Net.TestFramework/Codecs/CheapBastard/CheapBastardCodec.cs
new file mode 100644
index 0000000..0479c66
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Codecs/CheapBastard/CheapBastardCodec.cs
@@ -0,0 +1,54 @@
+\ufeffusing Lucene.Net.Codecs.DiskDV;
+using Lucene.Net.Codecs.Lucene40;
+using Lucene.Net.Codecs.Lucene41;
+using Lucene.Net.Codecs.Lucene46;
+
+namespace Lucene.Net.Codecs.CheapBastard
+{
+    /// <summary>
+    /// Codec that tries to use as little ram as possible because he spent all his money on beer
+    /// </summary>
+    // TODO: better name :) 
+    // but if we named it "LowMemory" in codecs/ package, it would be irresistible like optimize()!
+    public class CheapBastardCodec : FilterCodec
+    {
+        // TODO: would be better to have no terms index at all and bsearch a terms dict
+        private readonly PostingsFormat postings = new Lucene41PostingsFormat(100, 200);
+        // uncompressing versions, waste lots of disk but no ram
+        private readonly StoredFieldsFormat storedFields = new Lucene40StoredFieldsFormat();
+        private readonly TermVectorsFormat termVectors = new Lucene40TermVectorsFormat();
+        // these go to disk for all docvalues/norms datastructures
+        private readonly DocValuesFormat docValues = new DiskDocValuesFormat();
+        private readonly NormsFormat norms = new DiskNormsFormat();
+
+        public CheapBastardCodec()
+            : base(new Lucene46Codec())
+        {
+        }
+
+        public override PostingsFormat PostingsFormat
+        {
+            get { return postings; }
+        }
+
+        public override DocValuesFormat DocValuesFormat
+        {
+            get { return docValues; }
+        }
+
+        public override NormsFormat NormsFormat
+        {
+            get { return norms; }
+        }
+
+        public override StoredFieldsFormat StoredFieldsFormat
+        {
+            get { return storedFields; }
+        }
+
+        public override TermVectorsFormat TermVectorsFormat
+        {
+            get { return termVectors; }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e4d17c1/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index c972f03..a5c20b3 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -141,6 +141,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Codecs\Bloom\TestBloomFilteredLucene41Postings.cs" />
+    <Compile Include="Codecs\CheapBastard\CheapBastardCodec.cs" />
     <Compile Include="Codecs\Compressing\CompressingCodec.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e4d17c1/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index 0a34665..ce0ddfa 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -8,6 +8,7 @@ namespace Lucene.Net.Util
 {
     using Codecs;
     using Codecs.Asserting;
+    using Codecs.CheapBastard;
     using Codecs.Compressing;
     using Codecs.Lucene3x;
     using Codecs.Lucene40;
@@ -221,12 +222,11 @@ namespace Lucene.Net.Util
             {
                 codec = new SimpleTextCodec();
             }
-            // LUCENENET TODO: Implement CheapBastardCodec
-            //else if ("CheapBastard".equals(LuceneTestCase.TEST_CODEC) || ("random".equals(LuceneTestCase.TEST_CODEC) && randomVal == 8 && !ShouldAvoidCodec("CheapBastard") && !ShouldAvoidCodec("Lucene41")))
-            //{
-            //    // we also avoid this codec if Lucene41 is avoided, since thats the postings format it uses.
-            //    codec = new CheapBastardCodec();
-            //}
+            else if ("CheapBastard".equals(LuceneTestCase.TEST_CODEC) || ("random".equals(LuceneTestCase.TEST_CODEC) && randomVal == 8 && !ShouldAvoidCodec("CheapBastard") && !ShouldAvoidCodec("Lucene41")))
+            {
+                // we also avoid this codec if Lucene41 is avoided, since thats the postings format it uses.
+                codec = new CheapBastardCodec();
+            }
             else if ("Asserting".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 6 && !ShouldAvoidCodec("Asserting")))
             {
                 codec = new AssertingCodec();


[20/20] lucenenet git commit: Lucene.Net.TestFramework.Util.LuceneTestCase: Printing out culture and time zone to console to make debugging easier.

Posted by ni...@apache.org.
Lucene.Net.TestFramework.Util.LuceneTestCase: Printing out culture and time zone to console to make debugging easier.


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

Branch: refs/heads/api-work
Commit: 2ddcc94bf8269854a722045d2c7809cdff704d12
Parents: 4e105bc
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 19:19:59 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 19:19:59 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ddcc94b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 47f8dca..8e623d6 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -592,6 +592,15 @@ namespace Lucene.Net.Util
         {
             // LUCENENET TODO: Not sure how to convert these
             //ParentChainCallRule.SetupCalled = true;
+
+            if (LuceneTestCase.VERBOSE)
+            {
+                Console.Write("Culture: ");
+                Console.WriteLine(this.ClassEnvRule.locale.Name);
+
+                Console.Write("Time Zone: ");
+                Console.WriteLine(this.ClassEnvRule.timeZone.DisplayName);
+            }
         }
 
         /// <summary>


[10/20] lucenenet git commit: Lucene.Net.TestFramework: Completed implementation of RandomCodec

Posted by ni...@apache.org.
Lucene.Net.TestFramework: Completed implementation of RandomCodec


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

Branch: refs/heads/api-work
Commit: b43c69b8915926d404f9aaaac2500dc4e0fbcf2f
Parents: 84f26aa
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 05:24:09 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 05:56:22 2017 +0700

----------------------------------------------------------------------
 .../Index/RandomCodec.cs                        | 188 ++++++++++---------
 .../Util/TestRuleSetupAndRestoreClassEnv.cs     |   2 +-
 2 files changed, 99 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b43c69b8/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/RandomCodec.cs b/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
index 68d0098..0afec03 100644
--- a/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
+++ b/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
@@ -1,63 +1,62 @@
 using Lucene.Net.Support;
-using Lucene.Net.Codecs;
+using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 
 namespace Lucene.Net.Index
 {
-    
+    /*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
     using AssertingDocValuesFormat = Lucene.Net.Codecs.Asserting.AssertingDocValuesFormat;
     using AssertingPostingsFormat = Lucene.Net.Codecs.Asserting.AssertingPostingsFormat;
 
-    /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
-
     using DocValuesFormat = Lucene.Net.Codecs.DocValuesFormat;
 
-    //using TestBloomFilteredLucene41Postings = Lucene.Net.Codecs.bloom.TestBloomFilteredLucene41Postings;
-    //using DiskDocValuesFormat = Lucene.Net.Codecs.diskdv.DiskDocValuesFormat;
+    using TestBloomFilteredLucene41Postings = Lucene.Net.Codecs.Bloom.TestBloomFilteredLucene41Postings;
+    using DiskDocValuesFormat = Lucene.Net.Codecs.DiskDV.DiskDocValuesFormat;
     using Lucene41PostingsFormat = Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat;
 
-    //using Lucene41WithOrds = Lucene.Net.Codecs.Lucene41ords.Lucene41WithOrds;
+    using Lucene41WithOrds = Lucene.Net.Codecs.Lucene41Ords.Lucene41WithOrds;
     using Lucene45DocValuesFormat = Lucene.Net.Codecs.Lucene45.Lucene45DocValuesFormat;
     using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec;
     using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
 
-    //using DirectPostingsFormat = Lucene.Net.Codecs.memory.DirectPostingsFormat;
-    //using MemoryDocValuesFormat = Lucene.Net.Codecs.memory.MemoryDocValuesFormat;
-    //using MemoryPostingsFormat = Lucene.Net.Codecs.memory.MemoryPostingsFormat;
-    //using MockFixedIntBlockPostingsFormat = Lucene.Net.Codecs.mockintblock.MockFixedIntBlockPostingsFormat;
-    //using MockVariableIntBlockPostingsFormat = Lucene.Net.Codecs.mockintblock.MockVariableIntBlockPostingsFormat;
-    //using MockRandomPostingsFormat = Lucene.Net.Codecs.mockrandom.MockRandomPostingsFormat;
-    //using MockSepPostingsFormat = Lucene.Net.Codecs.mocksep.MockSepPostingsFormat;
-    //using NestedPulsingPostingsFormat = Lucene.Net.Codecs.nestedpulsing.NestedPulsingPostingsFormat;
-    //using Pulsing41PostingsFormat = Lucene.Net.Codecs.pulsing.Pulsing41PostingsFormat;
-    //using SimpleTextDocValuesFormat = Lucene.Net.Codecs.simpletext.SimpleTextDocValuesFormat;
-    //using SimpleTextPostingsFormat = Lucene.Net.Codecs.simpletext.SimpleTextPostingsFormat;
-    //using FSTOrdPostingsFormat = Lucene.Net.Codecs.memory.FSTOrdPostingsFormat;
-    //using FSTOrdPulsing41PostingsFormat = Lucene.Net.Codecs.memory.FSTOrdPulsing41PostingsFormat;
-    //using FSTPostingsFormat = Lucene.Net.Codecs.memory.FSTPostingsFormat;
-    //using FSTPulsing41PostingsFormat = Lucene.Net.Codecs.memory.FSTPulsing41PostingsFormat;
+    using DirectPostingsFormat = Lucene.Net.Codecs.Memory.DirectPostingsFormat;
+    using MemoryDocValuesFormat = Lucene.Net.Codecs.Memory.MemoryDocValuesFormat;
+    using MemoryPostingsFormat = Lucene.Net.Codecs.Memory.MemoryPostingsFormat;
+    using MockFixedIntBlockPostingsFormat = Lucene.Net.Codecs.MockIntBlock.MockFixedIntBlockPostingsFormat;
+    using MockVariableIntBlockPostingsFormat = Lucene.Net.Codecs.MockIntBlock.MockVariableIntBlockPostingsFormat;
+    using MockRandomPostingsFormat = Lucene.Net.Codecs.MockRandom.MockRandomPostingsFormat;
+    using MockSepPostingsFormat = Lucene.Net.Codecs.MockSep.MockSepPostingsFormat;
+    using NestedPulsingPostingsFormat = Lucene.Net.Codecs.NestedPulsing.NestedPulsingPostingsFormat;
+    using Pulsing41PostingsFormat = Lucene.Net.Codecs.Pulsing.Pulsing41PostingsFormat;
+    using SimpleTextDocValuesFormat = Lucene.Net.Codecs.SimpleText.SimpleTextDocValuesFormat;
+    using SimpleTextPostingsFormat = Lucene.Net.Codecs.SimpleText.SimpleTextPostingsFormat;
+    using FSTOrdPostingsFormat = Lucene.Net.Codecs.Memory.FSTOrdPostingsFormat;
+    using FSTOrdPulsing41PostingsFormat = Lucene.Net.Codecs.Memory.FSTOrdPulsing41PostingsFormat;
+    using FSTPostingsFormat = Lucene.Net.Codecs.Memory.FSTPostingsFormat;
+    using FSTPulsing41PostingsFormat = Lucene.Net.Codecs.Memory.FSTPulsing41PostingsFormat;
     using TestUtil = Lucene.Net.Util.TestUtil;
 
     /// <summary>
     /// Codec that assigns per-field random postings formats.
-    /// <p>
+    /// <para/>
     /// The same field/format assignment will happen regardless of order,
     /// a hash is computed up front that determines the mapping.
     /// this means fields can be put into things like HashSets and added to
@@ -69,110 +68,119 @@ namespace Lucene.Net.Index
     {
         /// <summary>
         /// Shuffled list of postings formats to use for new mappings </summary>
-        private IList<PostingsFormat> Formats = new List<PostingsFormat>();
+        private IList<PostingsFormat> formats = new List<PostingsFormat>();
 
         /// <summary>
         /// Shuffled list of docvalues formats to use for new mappings </summary>
-        private IList<DocValuesFormat> DvFormats = new List<DocValuesFormat>();
+        private IList<DocValuesFormat> dvFormats = new List<DocValuesFormat>();
 
         /// <summary>
         /// unique set of format names this codec knows about </summary>
-        public HashSet<string> FormatNames = new HashSet<string>();
+        public ISet<string> formatNames = new HashSet<string>();
 
         /// <summary>
         /// unique set of docvalues format names this codec knows about </summary>
-        public HashSet<string> DvFormatNames = new HashSet<string>();
+        public ISet<string> dvFormatNames = new HashSet<string>();
 
         /// <summary>
         /// memorized field->postingsformat mappings </summary>
         // note: we have to sync this map even though its just for debugging/toString,
         // otherwise DWPT's .toString() calls that iterate over the map can
         // cause concurrentmodificationexception if indexwriter's infostream is on
-        private readonly IDictionary<string, PostingsFormat> PreviousMappings = new ConcurrentHashMapWrapper<string, PostingsFormat>(new Dictionary<string, PostingsFormat>());
+        private readonly IDictionary<string, PostingsFormat> previousMappings = new ConcurrentHashMapWrapper<string, PostingsFormat>(new Dictionary<string, PostingsFormat>());
 
-        private IDictionary<string, DocValuesFormat> PreviousDVMappings = new ConcurrentHashMapWrapper<string, DocValuesFormat>(new Dictionary<string, DocValuesFormat>());
-        private readonly int PerFieldSeed;
+        private IDictionary<string, DocValuesFormat> previousDVMappings = new ConcurrentHashMapWrapper<string, DocValuesFormat>(new Dictionary<string, DocValuesFormat>());
+        private readonly int perFieldSeed;
 
         public override PostingsFormat GetPostingsFormatForField(string name)
         {
-            PostingsFormat codec = PreviousMappings[name];
+            PostingsFormat codec = previousMappings[name];
             if (codec == null)
             {
-                codec = Formats[Math.Abs(PerFieldSeed ^ name.GetHashCode()) % Formats.Count];
-                /*if (codec is SimpleTextPostingsFormat && PerFieldSeed % 5 != 0)
+                codec = formats[Math.Abs(perFieldSeed ^ name.GetHashCode()) % formats.Count];
+                if (codec is SimpleTextPostingsFormat && perFieldSeed % 5 != 0)
                 {
                   // make simpletext rarer, choose again
-                  codec = Formats[Math.Abs(PerFieldSeed ^ name.ToUpper(CultureInfo.InvariantCulture).GetHashCode()) % Formats.Count];
-                }*/
-                PreviousMappings[name] = codec;
+                  codec = formats[Math.Abs(perFieldSeed ^ name.ToUpperInvariant().GetHashCode()) % formats.Count];
+                }
+                previousMappings[name] = codec;
                 // Safety:
-                Debug.Assert(PreviousMappings.Count < 10000, "test went insane");
+                Debug.Assert(previousMappings.Count < 10000, "test went insane");
             }
             return codec;
         }
 
         public override DocValuesFormat GetDocValuesFormatForField(string name)
         {
-            DocValuesFormat codec = PreviousDVMappings[name];
+            DocValuesFormat codec = previousDVMappings[name];
             if (codec == null)
             {
-                codec = DvFormats[Math.Abs(PerFieldSeed ^ name.GetHashCode()) % DvFormats.Count];
-                /*if (codec is SimpleTextDocValuesFormat && PerFieldSeed % 5 != 0)
+                codec = dvFormats[Math.Abs(perFieldSeed ^ name.GetHashCode()) % dvFormats.Count];
+                if (codec is SimpleTextDocValuesFormat && perFieldSeed % 5 != 0)
                 {
                   // make simpletext rarer, choose again
-                  codec = DvFormats[Math.Abs(PerFieldSeed ^ name.ToUpper(CultureInfo.InvariantCulture).GetHashCode()) % DvFormats.Count];
-                }*/
-                PreviousDVMappings[name] = codec;
+                  codec = dvFormats[Math.Abs(perFieldSeed ^ name.ToUpperInvariant().GetHashCode()) % dvFormats.Count];
+                }
+                previousDVMappings[name] = codec;
                 // Safety:
-                Debug.Assert(PreviousDVMappings.Count < 10000, "test went insane");
+                Debug.Assert(previousDVMappings.Count < 10000, "test went insane");
             }
             return codec;
         }
 
         public RandomCodec(Random random, ISet<string> avoidCodecs)
         {
-            this.PerFieldSeed = random.Next();
+            this.perFieldSeed = random.Next();
             // TODO: make it possible to specify min/max iterms per
             // block via CL:
             int minItemsPerBlock = TestUtil.NextInt(random, 2, 100);
             int maxItemsPerBlock = 2 * (Math.Max(2, minItemsPerBlock - 1)) + random.Next(100);
             int lowFreqCutoff = TestUtil.NextInt(random, 2, 100);
 
-            // LUCENENET TODO: Finish RandomCodec implementation
             Add(avoidCodecs,
                 new Lucene41PostingsFormat(minItemsPerBlock, maxItemsPerBlock),
-                /*
                 new FSTPostingsFormat(),
                 new FSTOrdPostingsFormat(),
                 new FSTPulsing41PostingsFormat(1 + random.Next(20)), new FSTOrdPulsing41PostingsFormat(1 + random.Next(20)),
-                new DirectPostingsFormat(LuceneTestCase.Rarely(random) ? 1 : (LuceneTestCase.Rarely(random) ? int.MaxValue : maxItemsPerBlock), LuceneTestCase.Rarely(random) ? 1 : (LuceneTestCase.Rarely(random) ? int.MaxValue : lowFreqCutoff)),
-                new Pulsing41PostingsFormat(1 + random.Next(20), minItemsPerBlock, maxItemsPerBlock), new Pulsing41PostingsFormat(1 + random.Next(20), minItemsPerBlock, maxItemsPerBlock),
-                new TestBloomFilteredLucene41Postings(), new MockSepPostingsFormat(), new MockFixedIntBlockPostingsFormat(TestUtil.NextInt(random, 1, 2000)),
-                new MockVariableIntBlockPostingsFormat(TestUtil.NextInt(random, 1, 127)), new MockRandomPostingsFormat(random),
-                new NestedPulsingPostingsFormat(), new Lucene41WithOrds(), new SimpleTextPostingsFormat(),
-                */
-                new AssertingPostingsFormat()
-                /*new MemoryPostingsFormat(true, random.nextFloat()), new MemoryPostingsFormat(false, random.nextFloat())*/
-                );
-
-            // add pulsing again with (usually) different parameters
-            //TODO as a PostingsFormat which wraps others, we should allow TestBloomFilteredLucene41Postings to be constructed
-            //with a choice of concrete PostingsFormats. Maybe useful to have a generic means of marking and dealing
-            //with such "wrapper" classes?
-
-            AddDocValues(avoidCodecs, new Lucene45DocValuesFormat(), /*new DiskDocValuesFormat(), new MemoryDocValuesFormat(), new SimpleTextDocValuesFormat(),*/ new AssertingDocValuesFormat());
-
-            Collections.Shuffle(Formats);
-            Collections.Shuffle(DvFormats);
+                new DirectPostingsFormat(LuceneTestCase.Rarely(random) ? 1 : (LuceneTestCase.Rarely(random) ? int.MaxValue : maxItemsPerBlock), 
+                                        LuceneTestCase.Rarely(random) ? 1 : (LuceneTestCase.Rarely(random) ? int.MaxValue : lowFreqCutoff)),
+                new Pulsing41PostingsFormat(1 + random.Next(20), minItemsPerBlock, maxItemsPerBlock),
+                // add pulsing again with (usually) different parameters
+                new Pulsing41PostingsFormat(1 + random.Next(20), minItemsPerBlock, maxItemsPerBlock),
+                //TODO as a PostingsFormat which wraps others, we should allow TestBloomFilteredLucene41Postings to be constructed 
+                //with a choice of concrete PostingsFormats. Maybe useful to have a generic means of marking and dealing 
+                //with such "wrapper" classes?
+                new TestBloomFilteredLucene41Postings(), 
+                new MockSepPostingsFormat(), 
+                new MockFixedIntBlockPostingsFormat(TestUtil.NextInt(random, 1, 2000)),
+                new MockVariableIntBlockPostingsFormat(TestUtil.NextInt(random, 1, 127)), 
+                new MockRandomPostingsFormat(random),
+                new NestedPulsingPostingsFormat(), 
+                new Lucene41WithOrds(), 
+                new SimpleTextPostingsFormat(),
+                new AssertingPostingsFormat(),
+                new MemoryPostingsFormat(true, random.nextFloat()), 
+                new MemoryPostingsFormat(false, random.nextFloat())
+            );
+
+            AddDocValues(avoidCodecs, 
+                new Lucene45DocValuesFormat(), 
+                new DiskDocValuesFormat(), 
+                new MemoryDocValuesFormat(), 
+                new SimpleTextDocValuesFormat(), 
+                new AssertingDocValuesFormat());
+
+            Collections.Shuffle(formats);
+            Collections.Shuffle(dvFormats);
 
             // Avoid too many open files:
-            if (Formats.Count > 4)
+            if (formats.Count > 4)
             {
-                Formats = Formats.SubList(0, 4);
+                formats = formats.SubList(0, 4);
             }
-            if (DvFormats.Count > 4)
+            if (dvFormats.Count > 4)
             {
-                DvFormats = DvFormats.SubList(0, 4);
+                dvFormats = dvFormats.SubList(0, 4);
             }
         }
 
@@ -187,8 +195,8 @@ namespace Lucene.Net.Index
             {
                 if (!avoidCodecs.Contains(p.Name))
                 {
-                    Formats.Add(p);
-                    FormatNames.Add(p.Name);
+                    formats.Add(p);
+                    formatNames.Add(p.Name);
                 }
             }
         }
@@ -199,15 +207,15 @@ namespace Lucene.Net.Index
             {
                 if (!avoidCodecs.Contains(d.Name))
                 {
-                    DvFormats.Add(d);
-                    DvFormatNames.Add(d.Name);
+                    dvFormats.Add(d);
+                    dvFormatNames.Add(d.Name);
                 }
             }
         }
 
         public override string ToString()
         {
-            return base.ToString() + ": " + PreviousMappings.ToString() + ", docValues:" + PreviousDVMappings.ToString();
+            return base.ToString() + ": " + previousMappings.ToString() + ", docValues:" + previousDVMappings.ToString();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b43c69b8/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index bef99b6..ba4be2c 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -530,7 +530,7 @@ namespace Lucene.Net.Util
 
             if (codec is RandomCodec && avoidCodecs.Count > 0)
             {
-                foreach (string name in ((RandomCodec)codec).FormatNames)
+                foreach (string name in ((RandomCodec)codec).formatNames)
                 {
                     LuceneTestCase.AssumeFalse("Class not allowed to use postings format: " + name + ".", ShouldAvoidCodec(name));
                 }


[02/20] lucenenet git commit: Lucene.Net.TestFramework: Setup TestRuleSetupAndRestoreClassEnv to function similarly to the way it did in JUnit by executing it directly from LuceneTestCase. Completed more of the implementation, including setting the defau

Posted by ni...@apache.org.
Lucene.Net.TestFramework: Setup TestRuleSetupAndRestoreClassEnv to function similarly to the way it did in JUnit by executing it directly from LuceneTestCase. Completed more of the implementation, including setting the default codec randomly and excluding codecs from SuppressCodecsAttribute.


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

Branch: refs/heads/api-work
Commit: 51075743778b32dbde8acb020db79e5bdd0a443d
Parents: 3527406
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Mon Feb 27 20:16:03 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Mon Feb 27 23:19:59 2017 +0700

----------------------------------------------------------------------
 .../Analysis/BaseTokenStreamTestCase.cs         |   2 +-
 .../Index/BaseDocValuesFormatTestCase.cs        |  24 +-
 .../Index/BaseStoredFieldsFormatTestCase.cs     |   6 +-
 .../Index/BaseTermVectorsFormatTestCase.cs      |  14 +-
 .../AbstractBeforeAfterRule.cs                  |  19 ++
 .../Lucene.Net.TestFramework.csproj             |   1 +
 .../Search/SearchEquivalenceTestBase.cs         |   2 +-
 .../Util/LuceneTestCase.cs                      |  28 +-
 .../Util/TestRuleSetupAndRestoreClassEnv.cs     | 280 +++++++++++--------
 src/Lucene.Net.Tests.Facet/FacetTestCase.cs     |   1 -
 .../Taxonomy/TestTaxonomyCombined.cs            |   1 -
 .../Index/TestBackwardsCompatibility.cs         |   1 -
 .../Index/TestBackwardsCompatibility3x.cs       |   1 -
 .../TestControlledRealTimeReopenThread.cs       |   1 -
 14 files changed, 224 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index 79b5c5f..f7acb7b 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -659,7 +659,7 @@ namespace Lucene.Net.Analysis
             if (Rarely(random) && codecOk)
             {
                 dir = NewFSDirectory(CreateTempDir("bttc"));
-                iw = new RandomIndexWriter(new Random((int)seed), dir, a, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                iw = new RandomIndexWriter(new Random((int)seed), dir, a, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             }
 
             bool success = false;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
index 07a7970..ff00927 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
@@ -88,7 +88,7 @@ namespace Lucene.Net.Index
         public virtual void TestOneNumber()
         {
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
             string text = "this is the text to be indexed. " + longTerm;
@@ -123,7 +123,7 @@ namespace Lucene.Net.Index
         public virtual void TestOneFloat()
         {
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
             string text = "this is the text to be indexed. " + longTerm;
@@ -158,7 +158,7 @@ namespace Lucene.Net.Index
         public virtual void TestTwoNumbers()
         {
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
             string text = "this is the text to be indexed. " + longTerm;
@@ -196,7 +196,7 @@ namespace Lucene.Net.Index
         public virtual void TestTwoBinaryValues()
         {
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
             string text = "this is the text to be indexed. " + longTerm;
@@ -237,7 +237,7 @@ namespace Lucene.Net.Index
         public virtual void TestTwoFieldsMixed()
         {
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
             string text = "this is the text to be indexed. " + longTerm;
@@ -277,7 +277,7 @@ namespace Lucene.Net.Index
         public virtual void TestThreeFieldsMixed()
         {
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
             string text = "this is the text to be indexed. " + longTerm;
@@ -322,7 +322,7 @@ namespace Lucene.Net.Index
         public virtual void TestThreeFieldsMixed2()
         {
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             string longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
             string text = "this is the text to be indexed. " + longTerm;
@@ -1835,7 +1835,7 @@ namespace Lucene.Net.Index
         {
             AssumeTrue("Codec does not support SORTED_SET", DefaultCodecSupportsSortedSet());
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
 
             Document doc = new Document();
             doc.Add(new SortedSetDocValuesField("field", new BytesRef("hello")));
@@ -1863,7 +1863,7 @@ namespace Lucene.Net.Index
         {
             AssumeTrue("Codec does not support SORTED_SET", DefaultCodecSupportsSortedSet());
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
 
             Document doc = new Document();
             doc.Add(new SortedSetDocValuesField("field", new BytesRef("hello")));
@@ -1946,7 +1946,7 @@ namespace Lucene.Net.Index
         {
             AssumeTrue("Codec does not support SORTED_SET", DefaultCodecSupportsSortedSet());
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
 
             Document doc = new Document();
             doc.Add(new SortedSetDocValuesField("field", new BytesRef("hello")));
@@ -1979,7 +1979,7 @@ namespace Lucene.Net.Index
         {
             AssumeTrue("Codec does not support SORTED_SET", DefaultCodecSupportsSortedSet());
             Directory directory = NewDirectory();
-            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, ClassEnvRule.similarity, ClassEnvRule.timeZone);
 
             Document doc = new Document();
             doc.Add(new SortedSetDocValuesField("field", new BytesRef("world")));
@@ -3478,7 +3478,7 @@ namespace Lucene.Net.Index
                     break;
                 }
                 Directory dir = NewDirectory();
-                RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
                 BytesRef bytes = new BytesRef();
                 bytes.Bytes = new byte[1 << i];
                 bytes.Length = 1 << i;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
index 4b831fb..3391128 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
@@ -266,7 +266,7 @@ namespace Lucene.Net.Index
         public virtual void TestNumericField()
         {
             Directory dir = NewDirectory();
-            var w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            var w = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             var numDocs = AtLeast(500);
             var answers = new object[numDocs];
             NumericType[] typeAnswers = new NumericType[numDocs];
@@ -351,7 +351,7 @@ namespace Lucene.Net.Index
         public virtual void TestIndexedBit()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             FieldType onlyStored = new FieldType();
             onlyStored.IsStored = true;
@@ -769,7 +769,7 @@ namespace Lucene.Net.Index
             }
             w.Commit();
             w.Dispose();
-            w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            w = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             w.ForceMerge(TestUtil.NextInt(Random(), 1, 3));
             w.Commit();
             w.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
index fb903a8..a7deafe 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -682,7 +682,7 @@ namespace Lucene.Net.Index
                 int docWithVectors = Random().Next(numDocs);
                 Document emptyDoc = new Document();
                 Directory dir = NewDirectory();
-                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
                 RandomDocument doc = docFactory.NewDocument(TestUtil.NextInt(Random(), 1, 3), 20, options);
                 for (int i = 0; i < numDocs; ++i)
                 {
@@ -729,7 +729,7 @@ namespace Lucene.Net.Index
                     continue;
                 }
                 using (Directory dir = NewDirectory())
-                using (RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone))
+                using (RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone))
                 {
                     RandomDocument doc = docFactory.NewDocument(TestUtil.NextInt(Random(), 1, 2), AtLeast(20000),
                         options);
@@ -747,7 +747,7 @@ namespace Lucene.Net.Index
             foreach (Options options in ValidOptions())
             {
                 Directory dir = NewDirectory();
-                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
                 RandomDocument doc = docFactory.NewDocument(AtLeast(100), 5, options);
                 writer.AddDocument(doc.ToDocument());
                 IndexReader reader = writer.Reader;
@@ -774,7 +774,7 @@ namespace Lucene.Net.Index
                     }
                     using (Directory dir = NewDirectory())
                     {
-                        using (var writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone))
+                        using (var writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone))
                         {
                             RandomDocument doc1 = docFactory.NewDocument(numFields, 20, options1);
                             RandomDocument doc2 = docFactory.NewDocument(numFields, 20, options2);
@@ -804,7 +804,7 @@ namespace Lucene.Net.Index
                 docs[i] = docFactory.NewDocument(TestUtil.NextInt(Random(), 1, 3), TestUtil.NextInt(Random(), 10, 50), RandomOptions());
             }
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             for (int i = 0; i < numDocs; ++i)
             {
                 writer.AddDocument(AddId(docs[i].ToDocument(), "" + i));
@@ -839,7 +839,7 @@ namespace Lucene.Net.Index
                     docs[i] = docFactory.NewDocument(TestUtil.NextInt(Random(), 1, 3), AtLeast(10), options);
                 }
                 Directory dir = NewDirectory();
-                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
                 for (int i = 0; i < numDocs; ++i)
                 {
                     writer.AddDocument(AddId(docs[i].ToDocument(), "" + i));
@@ -884,7 +884,7 @@ namespace Lucene.Net.Index
                     docs[i] = docFactory.NewDocument(TestUtil.NextInt(Random(), 1, 3), AtLeast(10), options);
                 }
                 Directory dir = NewDirectory();
-                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.similarity, ClassEnvRule.timeZone);
                 for (int i = 0; i < numDocs; ++i)
                 {
                     writer.AddDocument(AddId(docs[i].ToDocument(), "" + i));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/JavaCompatibility/AbstractBeforeAfterRule.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/JavaCompatibility/AbstractBeforeAfterRule.cs b/src/Lucene.Net.TestFramework/JavaCompatibility/AbstractBeforeAfterRule.cs
new file mode 100644
index 0000000..025f548
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/JavaCompatibility/AbstractBeforeAfterRule.cs
@@ -0,0 +1,19 @@
+\ufeffusing Lucene.Net.Util;
+
+namespace Lucene.Net.JavaCompatibility
+{
+    /// <summary>
+    /// LUCENENET specific for mimicking the JUnit rule functionality.
+    /// We simplify things by just running the rules inside LuceneTestCase.
+    /// </summary>
+    public abstract class AbstractBeforeAfterRule
+    {
+        public virtual void Before(LuceneTestCase testInstance)
+        {
+        }
+
+        public virtual void After(LuceneTestCase testInstance)
+        {
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index c6ad07b..f008111 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -320,6 +320,7 @@
     <Compile Include="Index\ThreadedIndexingAndSearchingTestCase.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="JavaCompatibility\AbstractBeforeAfterRule.cs" />
     <Compile Include="Randomized\Attributes\SeedAttribute.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs b/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
index 76c929a..312203b 100644
--- a/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
+++ b/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Search
             Stopword = "" + RandomChar();
             CharacterRunAutomaton stopset = new CharacterRunAutomaton(BasicAutomata.MakeString(Stopword));
             Analyzer = new MockAnalyzer(random, MockTokenizer.WHITESPACE, false, stopset);
-            RandomIndexWriter iw = new RandomIndexWriter(random, Directory, Analyzer, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(random, Directory, Analyzer, ClassEnvRule.similarity, ClassEnvRule.timeZone);
             Document doc = new Document();
             Field id = new StringField("id", "", Field.Store.NO);
             Field field = new TextField("field", "", Field.Store.NO);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 5dd3542..812e273 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -256,9 +256,9 @@ namespace Lucene.Net.Util
         /// (because they are expensive, for example).
         /// </summary>
         [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
-        public class SuppressCodecs : System.Attribute
+        public class SuppressCodecsAttribute : System.Attribute
         {
-            public SuppressCodecs(params string[] value)
+            public SuppressCodecsAttribute(params string[] value)
             {
                 this.Value = value;
             }
@@ -454,7 +454,7 @@ namespace Lucene.Net.Util
         /// Exposed because <see cref="TestRuleSetupAndRestoreClassEnv"/> is
         /// internal and this field is needed by other classes.
         /// </summary>
-        public Similarity Similarity { get { return ClassEnvRule.Similarity; } }
+        public Similarity Similarity { get { return ClassEnvRule.similarity; } }
 
         /// <summary>
         /// Gets the Timezone from the Class Environment setup rule
@@ -463,7 +463,7 @@ namespace Lucene.Net.Util
         /// Exposed because <see cref="TestRuleSetupAndRestoreClassEnv"/> is
         /// internal and this field is needed by other classes.
         /// </summary>
-        public TimeZoneInfo TimeZone { get { return ClassEnvRule.TimeZone; } }
+        public TimeZoneInfo TimeZone { get { return ClassEnvRule.timeZone; } }
 
         // LUCENENET TODO
         /// <summary>
@@ -603,7 +603,7 @@ namespace Lucene.Net.Util
             /* LUCENENET TODO: Not sure how to convert these
                 ParentChainCallRule.TeardownCalled = true;
                 */
-            CleanupTemporaryFiles(); // LUCENENET TODO: Move this to OneTimeTearDown()? Calling it here deletes files too early.
+            CleanupTemporaryFiles(); // LUCENENET TODO: Move this to OneTimeTearDown()? Calling it here deletes shared files too early.
         }
 
         // LUCENENET specific constants to scan the test framework for codecs/docvaluesformats/postingsformats only once
@@ -616,12 +616,20 @@ namespace Lucene.Net.Util
         [OneTimeSetUp]
         public virtual void BeforeClass()
         {
-            OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
-
             // Setup the factories
             Codec.SetCodecFactory(TEST_CODEC_FACTORY);
             DocValuesFormat.SetDocValuesFormatFactory(TEST_DOCVALUES_FORMAT_FACTORY);
             PostingsFormat.SetPostingsFormatFactory(TEST_POSTINGS_FORMAT_FACTORY);
+
+            // IMPORTANT: Call this line after calling Codec.SetCodecFactory() because both
+            // of them change Codec.Default
+            ClassEnvRule.Before(this);
+        }
+
+        [OneTimeTearDown]
+        public virtual void AfterClass()
+        {
+            ClassEnvRule.After(this);
         }
 
         // -----------------------------------------------------------------
@@ -900,7 +908,7 @@ namespace Lucene.Net.Util
         /// </summary>
         public IndexWriterConfig NewIndexWriterConfig(Random r, LuceneVersion v, Analyzer a)
         {
-            return NewIndexWriterConfig(r, v, a, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            return NewIndexWriterConfig(r, v, a, ClassEnvRule.similarity, ClassEnvRule.timeZone);
         }
 
         /// <summary>
@@ -1657,7 +1665,7 @@ namespace Lucene.Net.Util
         /// </summary>
         public IndexSearcher NewSearcher(IndexReader r)
         {
-            return NewSearcher(r, ClassEnvRule.Similarity);
+            return NewSearcher(r, ClassEnvRule.similarity);
         }
 
         /// <param name="similarity">
@@ -1693,7 +1701,7 @@ namespace Lucene.Net.Util
 
         public IndexSearcher NewSearcher(IndexReader r, bool maybeWrap, bool wrapWithAssertions)
         {
-            return NewSearcher(r, maybeWrap, wrapWithAssertions, ClassEnvRule.Similarity);
+            return NewSearcher(r, maybeWrap, wrapWithAssertions, ClassEnvRule.similarity);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index 68d8bdf..797d974 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -7,8 +7,21 @@ using System.Threading;
 namespace Lucene.Net.Util
 {
     using Codecs;
+    using Codecs.Asserting;
+    using Codecs.Compressing;
+    using Codecs.Lucene3x;
+    using Codecs.Lucene40;
+    using Codecs.Lucene41;
+    using Codecs.Lucene42;
+    using Codecs.Lucene45;
+    using Codecs.SimpleText;
+    using JavaCompatibility;
     //using AssumptionViolatedException = org.junit.@internal.AssumptionViolatedException;
     using Lucene.Net.Randomized.Generators;
+    using Support;
+    using System.Diagnostics;
+    using System.Linq;
+    using System.Reflection;
 
     /*
          * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -58,94 +71,119 @@ namespace Lucene.Net.Util
     /// Setup and restore suite-level environment (fine grained junk that
     /// doesn't fit anywhere else).
     /// </summary>
-    internal sealed class TestRuleSetupAndRestoreClassEnv// : AbstractBeforeAfterRule
+    internal sealed class TestRuleSetupAndRestoreClassEnv : AbstractBeforeAfterRule
     {
         /// <summary>
         /// Restore these system property values.
         /// </summary>
-        private Dictionary<string, string> RestoreProperties = new Dictionary<string, string>();
+        private Dictionary<string, string> restoreProperties = new Dictionary<string, string>();
 
-        //private Codec SavedCodec;
+        private Codec savedCodec;
         //private CultureInfo SavedLocale;
         //private InfoStream SavedInfoStream;
         //private TimeZoneInfo SavedTimeZone;
 
-        internal CultureInfo Locale;
-        internal TimeZoneInfo TimeZone;
-        internal Similarity Similarity;
-        internal Codec Codec;
+        internal CultureInfo locale;
+        internal TimeZoneInfo timeZone;
+        internal Similarity similarity;
+        internal Codec codec;
 
         /// <seealso cref= SuppressCodecs </seealso>
-        internal HashSet<string> AvoidCodecs;
+        internal HashSet<string> avoidCodecs;
 
-        public TestRuleSetupAndRestoreClassEnv()
+        public override void Before(LuceneTestCase testInstance)
         {
-            /*// if verbose: print some debugging stuff about which codecs are loaded.
+            // if verbose: print some debugging stuff about which codecs are loaded.
             if (LuceneTestCase.VERBOSE)
             {
-                ISet<string> codecs = Codec.AvailableCodecs();
+                ICollection<string> codecs = Codec.AvailableCodecs();
                 foreach (string codec in codecs)
                 {
                     Console.WriteLine("Loaded codec: '" + codec + "': " + Codec.ForName(codec).GetType().Name);
                 }
 
-                ISet<string> postingsFormats = PostingsFormat.AvailablePostingsFormats();
+                ICollection<string> postingsFormats = PostingsFormat.AvailablePostingsFormats();
                 foreach (string postingsFormat in postingsFormats)
                 {
                     Console.WriteLine("Loaded postingsFormat: '" + postingsFormat + "': " + PostingsFormat.ForName(postingsFormat).GetType().Name);
                 }
             }
 
-            SavedInfoStream = InfoStream.Default;
-            Random random = RandomizedContext.Current.Random;
-            bool v = random.NextBoolean();
-            if (LuceneTestCase.INFOSTREAM)
-            {
-                InfoStream.Default = new ThreadNameFixingPrintStreamInfoStream(Console.Out);
-            }
-            else if (v)
+            // LUCENENET TODO: Finish implementation ?
+            //SavedInfoStream = InfoStream.Default;
+            Random random = LuceneTestCase.Random(); //RandomizedContext.Current.Random;
+            //bool v = random.NextBoolean();
+            //if (LuceneTestCase.INFOSTREAM)
+            //{
+            //    InfoStream.Default = new ThreadNameFixingPrintStreamInfoStream(Console.Out);
+            //}
+            //else if (v)
+            //{
+            //    InfoStream.Default = new NullInfoStream();
+            //}
+
+            Type targetClass = testInstance.GetType();
+            avoidCodecs = new HashSet<string>();
+            var suppressCodecsAttribute = targetClass.GetTypeInfo().GetCustomAttribute<LuceneTestCase.SuppressCodecsAttribute>();
+            if (suppressCodecsAttribute != null)
             {
-                InfoStream.Default = new NullInfoStream();
+                avoidCodecs.AddAll(suppressCodecsAttribute.Value);
             }
 
-            Type targetClass = RandomizedContext.Current.GetTargetType;
-            AvoidCodecs = new HashSet<string>();
-
             // set back to default
             LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
 
-            SavedCodec = Codec.Default;
+            savedCodec = Codec.Default;
             int randomVal = random.Next(10);
-            if ("Lucene3x".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 3 && !ShouldAvoidCodec("Lucene3x"))) // preflex-only setup
-            {
-                Codec = Codec.ForName("Lucene3x");
-                Debug.Assert((Codec is PreFlexRWCodec), "fix your classpath to have tests-framework.jar before lucene-core.jar");
+            if ("Lucene3x".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) &&
+                                                                "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) &&
+                                                                "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) &&
+                                                                randomVal == 3 &&
+                                                                !ShouldAvoidCodec("Lucene3x"))) // preflex-only setup
+            {
+                codec = Codec.ForName("Lucene3x");
+                Debug.Assert((codec is PreFlexRWCodec), "fix your ICodecFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework");
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
             }
-            else if ("Lucene40".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && randomVal == 0 && !ShouldAvoidCodec("Lucene40"))) // 4.0 setup
+            else if ("Lucene40".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) &&
+                                                                    randomVal == 0 &&
+                                                                    !ShouldAvoidCodec("Lucene40"))) // 4.0 setup
             {
-                Codec = Codec.ForName("Lucene40");
+                codec = Codec.ForName("Lucene40");
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-                Debug.Assert(Codec is Lucene40RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
-                Debug.Assert((PostingsFormat.ForName("Lucene40") is Lucene40RWPostingsFormat), "fix your classpath to have tests-framework.jar before lucene-core.jar");
+                Debug.Assert((codec is Lucene40RWCodec), "fix your ICodecFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework");
+                Debug.Assert((PostingsFormat.ForName("Lucene40") is Lucene40RWPostingsFormat), "fix your IPostingsFormatFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
-            else if ("Lucene41".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 1 && !ShouldAvoidCodec("Lucene41")))
+            else if ("Lucene41".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) &&
+                                                                    randomVal == 1 &&
+                                                                    !ShouldAvoidCodec("Lucene41")))
             {
-                Codec = Codec.ForName("Lucene41");
+                codec = Codec.ForName("Lucene41");
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-                Debug.Assert(Codec is Lucene41RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
+                Debug.Assert((codec is Lucene41RWCodec), "fix your ICodecFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
-            else if ("Lucene42".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 2 && !ShouldAvoidCodec("Lucene42")))
+            else if ("Lucene42".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) &&
+                                                                    randomVal == 2 &&
+                                                                    !ShouldAvoidCodec("Lucene42")))
             {
-                Codec = Codec.ForName("Lucene42");
+                codec = Codec.ForName("Lucene42");
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-                Debug.Assert(Codec is Lucene42RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
+                Debug.Assert((codec is Lucene42RWCodec), "fix your ICodecFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
-            else if ("Lucene45".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 5 && !ShouldAvoidCodec("Lucene45")))
+            else if ("Lucene45".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) &&
+                                                                    "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) &&
+                                                                    randomVal == 5 &&
+                                                                    !ShouldAvoidCodec("Lucene45")))
             {
-                Codec = Codec.ForName("Lucene45");
+                codec = Codec.ForName("Lucene45");
                 LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-                Debug.Assert(Codec is Lucene45RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
+                Debug.Assert((codec is Lucene45RWCodec), "fix your ICodecFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework");
             }
             else if (("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) == false) || ("random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) == false))
             {
@@ -157,6 +195,11 @@ namespace Lucene.Net.Util
                 {
                     format = PostingsFormat.ForName("Lucene41");
                 }
+                // LUCENENET TODO: Implement MockRandomPostingsFormat
+                //else if ("MockRandom".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
+                //{
+                //    format = new MockRandomPostingsFormat(new Random(random.Next()));
+                //}
                 else
                 {
                     format = PostingsFormat.ForName(LuceneTestCase.TEST_POSTINGSFORMAT);
@@ -172,71 +215,72 @@ namespace Lucene.Net.Util
                     dvFormat = DocValuesFormat.ForName(LuceneTestCase.TEST_DOCVALUESFORMAT);
                 }
 
-                Codec = new Lucene46CodecAnonymousInnerClassHelper(this, format, dvFormat);
+                codec = new Lucene46CodecAnonymousInnerClassHelper(this, format, dvFormat);
             }
+            else if ("SimpleText".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 9 && LuceneTestCase.Rarely(random) && !ShouldAvoidCodec("SimpleText")))
+            {
+                codec = new SimpleTextCodec();
+            }
+            // LUCENENET TODO: Implement CheapBastardCodec
+            //else if ("CheapBastard".equals(LuceneTestCase.TEST_CODEC) || ("random".equals(LuceneTestCase.TEST_CODEC) && randomVal == 8 && !ShouldAvoidCodec("CheapBastard") && !ShouldAvoidCodec("Lucene41")))
+            //{
+            //    // we also avoid this codec if Lucene41 is avoided, since thats the postings format it uses.
+            //    codec = new CheapBastardCodec();
+            //}
             else if ("Asserting".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 6 && !ShouldAvoidCodec("Asserting")))
             {
-                Codec = new AssertingCodec();
+                codec = new AssertingCodec();
             }
             else if ("Compressing".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 5 && !ShouldAvoidCodec("Compressing")))
             {
-                Codec = CompressingCodec.RandomInstance(random);
+                codec = CompressingCodec.RandomInstance(random);
             }
             else if (!"random".Equals(LuceneTestCase.TEST_CODEC))
             {
-                Codec = Codec.ForName(LuceneTestCase.TEST_CODEC);
+                codec = Codec.ForName(LuceneTestCase.TEST_CODEC);
             }
             else if ("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
             {
-                Codec = new RandomCodec(random, AvoidCodecs);
+                codec = new RandomCodec(random, avoidCodecs);
             }
             else
             {
                 Debug.Assert(false);
             }
-            Codec.Default = Codec;
-            */
-            Random random = new Random(1);
-            Similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(new Random(1));
-            /*
+            Codec.Default = codec;
+
+            // LUCENENET TODO: Locale/time zone
+            //// Initialize locale/ timezone.
+            //string testLocale = System.getProperty("tests.locale", "random");
+            //string testTimeZone = System.getProperty("tests.timezone", "random");
+
+            //// Always pick a random one for consistency (whether tests.locale was specified or not).
+            //SavedLocale = Locale.Default;
+            //Locale randomLocale = RandomLocale(random);
+            //Locale = testLocale.Equals("random") ? randomLocale : localeForName(testLocale);
+            //Locale.Default = Locale;
+
+            //// TimeZone.getDefault will set user.timezone to the default timezone of the user's locale.
+            //// So store the original property value and restore it at end.
+            //RestoreProperties["user.timezone"] = System.getProperty("user.timezone");
+            //SavedTimeZone = TimeZone.Default;
+            //TimeZone randomTimeZone = RandomTimeZone(random);
+            //TimeZone = testTimeZone.Equals("random") ? randomTimeZone : TimeZone.getTimeZone(testTimeZone);
+            //TimeZone.Default = TimeZone;
+
+            similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(new Random(1));
+            
             // Check codec restrictions once at class level.
             try
             {
-                CheckCodecRestrictions(Codec);
+                CheckCodecRestrictions(codec);
             }
             catch (Exception e)
             {
-                Console.Error.WriteLine("NOTE: " + e.Message + " Suppressed codecs: " + Arrays.ToString(AvoidCodecs.ToArray()));
+                Console.Error.WriteLine("NOTE: " + e.Message + " Suppressed codecs: " + Arrays.ToString(avoidCodecs.ToArray()));
                 throw e;
-            }*/
-        }
-
-        /*~TestRuleSetupAndRestoreClassEnv()
-        {
-            foreach (KeyValuePair<string, string> e in RestoreProperties)
-            {
-                if (e.Value == null)
-                {
-                    System.ClearProperty(e.Key);
-                }
-                else
-                {
-                    System.setProperty(e.Key, e.Value);
-                }
-            }
-            RestoreProperties.Clear();
-
-            Codec.Default = SavedCodec;
-            InfoStream.Default = SavedInfoStream;
-            if (SavedLocale != null)
-            {
-                Locale = SavedLocale;
             }
-            if (SavedTimeZone != null)
-            {
-                TimeZone = SavedTimeZone;
-            }
-        }*/
+        }
 
         internal class ThreadNameFixingPrintStreamInfoStream : PrintStreamInfoStream
         {
@@ -448,31 +492,31 @@ namespace Lucene.Net.Util
 
         private class Lucene46CodecAnonymousInnerClassHelper : Lucene46Codec
         {
-            private readonly TestRuleSetupAndRestoreClassEnv OuterInstance;
+            private readonly TestRuleSetupAndRestoreClassEnv outerInstance;
 
-            private PostingsFormat Format;
-            private DocValuesFormat DvFormat;
+            private PostingsFormat format;
+            private DocValuesFormat dvFormat;
 
             public Lucene46CodecAnonymousInnerClassHelper(TestRuleSetupAndRestoreClassEnv outerInstance, PostingsFormat format, DocValuesFormat dvFormat)
             {
-                this.OuterInstance = outerInstance;
-                this.Format = format;
-                this.DvFormat = dvFormat;
+                this.outerInstance = outerInstance;
+                this.format = format;
+                this.dvFormat = dvFormat;
             }
 
             public override PostingsFormat GetPostingsFormatForField(string field)
             {
-                return Format;
+                return format;
             }
 
             public override DocValuesFormat GetDocValuesFormatForField(string field)
             {
-                return DvFormat;
+                return dvFormat;
             }
 
             public override string ToString()
             {
-                return base.ToString() + ": " + Format.ToString() + ", " + DvFormat.ToString();
+                return base.ToString() + ": " + format.ToString() + ", " + dvFormat.ToString();
             }
         }
 
@@ -484,7 +528,7 @@ namespace Lucene.Net.Util
         {
             LuceneTestCase.AssumeFalse("Class not allowed to use codec: " + codec.Name + ".", ShouldAvoidCodec(codec.Name));
 
-            if (codec is RandomCodec && AvoidCodecs.Count > 0)
+            if (codec is RandomCodec && avoidCodecs.Count > 0)
             {
                 foreach (string name in ((RandomCodec)codec).FormatNames)
                 {
@@ -501,39 +545,39 @@ namespace Lucene.Net.Util
         /// <summary>
         /// After suite cleanup (always invoked).
         /// </summary>
-        /*protected internal override void After()
+        public override void After(LuceneTestCase testInstance)
         {
-          foreach (KeyValuePair<string, string> e in RestoreProperties)
-          {
-            if (e.Value == null)
-            {
-              System.ClearProperty(e.Key);
-            }
-            else
-            {
-              System.setProperty(e.Key, e.Value);
-            }
-          }
-          RestoreProperties.Clear();
-
-          Codec.Default = SavedCodec;
-          InfoStream.Default = SavedInfoStream;
-          if (SavedLocale != null)
-          {
-              Locale = SavedLocale;
-          }
-          if (SavedTimeZone != null)
-          {
-              TimeZone = SavedTimeZone;
-          }
-        }*/
+            //foreach (KeyValuePair<string, string> e in restoreProperties)
+            //{
+            //    if (e.Value == null)
+            //    {
+            //        System.ClearProperty(e.Key);
+            //    }
+            //    else
+            //    {
+            //        System.setProperty(e.Key, e.Value);
+            //    }
+            //}
+            restoreProperties.Clear();
+
+            Codec.Default = savedCodec;
+            //InfoStream.Default = savedInfoStream;
+            //if (savedLocale != null)
+            //{
+            //    locale = savedLocale;
+            //}
+            //if (savedTimeZone != null)
+            //{
+            //    timeZone = savedTimeZone;
+            //}
+        }
 
         /// <summary>
         /// Should a given codec be avoided for the currently executing suite?
         /// </summary>
         private bool ShouldAvoidCodec(string codec)
         {
-            return AvoidCodecs.Count > 0 && AvoidCodecs.Contains(codec);
+            return avoidCodecs.Count > 0 && avoidCodecs.Contains(codec);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
index 849f32a..39b9b6e 100644
--- a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
+++ b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
@@ -35,7 +35,6 @@ namespace Lucene.Net.Facet
     using TaxonomyFacetCounts = Lucene.Net.Facet.Taxonomy.TaxonomyFacetCounts;
     using TaxonomyReader = Lucene.Net.Facet.Taxonomy.TaxonomyReader;
     using BytesRef = Lucene.Net.Util.BytesRef;
-    using SuppressCodecs = Lucene.Net.Util.LuceneTestCase.SuppressCodecs;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
     using TestUtil = Lucene.Net.Util.TestUtil;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
index 4e4b164..c722d7e 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
@@ -15,7 +15,6 @@ namespace Lucene.Net.Facet.Taxonomy
     using Directory = Lucene.Net.Store.Directory;
     using LockObtainFailedException = Lucene.Net.Store.LockObtainFailedException;
     using RAMDirectory = Lucene.Net.Store.RAMDirectory;
-    using SuppressCodecs = Lucene.Net.Util.LuceneTestCase.SuppressCodecs;
 
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
index 8b6f78d..163bbc7 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
@@ -59,7 +59,6 @@ namespace Lucene.Net.Index
     using Constants = Lucene.Net.Util.Constants;
     using IOUtils = Lucene.Net.Util.IOUtils;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-    using SuppressCodecs = Lucene.Net.Util.LuceneTestCase.SuppressCodecs;
     using StringHelper = Lucene.Net.Util.StringHelper;
     using TestUtil = Lucene.Net.Util.TestUtil;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
index 9ee601f..19a2e98 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
@@ -58,7 +58,6 @@ namespace Lucene.Net.Index
     using BytesRef = Lucene.Net.Util.BytesRef;
     using Constants = Lucene.Net.Util.Constants;
     using StringHelper = Lucene.Net.Util.StringHelper;
-    using SuppressCodecs = Lucene.Net.Util.LuceneTestCase.SuppressCodecs;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
     using TestUtil = Lucene.Net.Util.TestUtil;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51075743/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
index d447b9e..7e6d24e 100644
--- a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
+++ b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
@@ -49,7 +49,6 @@ namespace Lucene.Net.Search
     using Directory = Lucene.Net.Store.Directory;
     using NRTCachingDirectory = Lucene.Net.Store.NRTCachingDirectory;
     using IOUtils = Lucene.Net.Util.IOUtils;
-    using SuppressCodecs = Lucene.Net.Util.LuceneTestCase.SuppressCodecs;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
     using TestUtil = Lucene.Net.Util.TestUtil;
     //using ThreadInterruptedException = Lucene.Net.Util.ThreadInterruptedException;


[19/20] lucenenet git commit: Lucene.Net.QueryParser.Flexible.Standard.Cofig.NumberDateFormat: Fixed potential bug with parsing number without specifying culture by changing it to invariant culture

Posted by ni...@apache.org.
Lucene.Net.QueryParser.Flexible.Standard.Cofig.NumberDateFormat: Fixed potential bug with parsing number without specifying culture by changing it to invariant culture


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

Branch: refs/heads/api-work
Commit: 4e105bc9c126b377badb21aaf5676725fcae8e7b
Parents: 1d1ff89
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 18:49:44 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 18:49:44 2017 +0700

----------------------------------------------------------------------
 .../Flexible/Standard/Config/NumberDateFormat.cs                   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e105bc9/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
index 940950d..1a856cf 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
@@ -96,7 +96,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
 
         public override string Format(object number)
         {
-            return new DateTime(EPOCH).AddMilliseconds(Convert.ToInt64(number)).ToString(GetDateFormat(), this.locale);
+            return new DateTime(EPOCH).AddMilliseconds(Convert.ToInt64(number, CultureInfo.InvariantCulture)).ToString(GetDateFormat(), this.locale);
         }
 
         /// <summary>


[11/20] lucenenet git commit: Lucene.Net.TestFramework.Index.RandomCodec: Removed IgnoreCodec attribute, which makes RandomCodec replace the Lucene46Codec in the tests.

Posted by ni...@apache.org.
Lucene.Net.TestFramework.Index.RandomCodec: Removed IgnoreCodec attribute, which makes RandomCodec replace the Lucene46Codec in the tests.


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

Branch: refs/heads/api-work
Commit: 56307f18b1848ef0efadb5ff0fd24c023cf8d12e
Parents: b43c69b
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 05:52:07 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 05:56:23 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Index/RandomCodec.cs | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56307f18/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/RandomCodec.cs b/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
index 0afec03..6ed24d5 100644
--- a/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
+++ b/src/Lucene.Net.TestFramework/Index/RandomCodec.cs
@@ -63,7 +63,6 @@ namespace Lucene.Net.Index
     /// documents in different orders and the test will still be deterministic
     /// and reproducable.
     /// </summary>
-    [IgnoreCodec] // LUCENENET TODO: I believe this codec should be not ignored in the test environment and should be used in place of Lucene46 codec.
     public class RandomCodec : Lucene46Codec
     {
         /// <summary>


[12/20] lucenenet git commit: Lucene.Net.Core.Support.Util.NamedServiceFactory: Fixed IsServiceType() and GetServiceName() methods to support .NET Core.

Posted by ni...@apache.org.
Lucene.Net.Core.Support.Util.NamedServiceFactory: Fixed IsServiceType() and GetServiceName() methods to support .NET Core.


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

Branch: refs/heads/api-work
Commit: 5c3392d2218ad85d67cc0b4fd9369c5de086bd5a
Parents: 56307f1
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 08:34:48 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 08:34:48 2017 +0700

----------------------------------------------------------------------
 .../Support/Util/NamedServiceFactory.cs              | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5c3392d2/src/Lucene.Net.Core/Support/Util/NamedServiceFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Util/NamedServiceFactory.cs b/src/Lucene.Net.Core/Support/Util/NamedServiceFactory.cs
index 343f476..06af811 100644
--- a/src/Lucene.Net.Core/Support/Util/NamedServiceFactory.cs
+++ b/src/Lucene.Net.Core/Support/Util/NamedServiceFactory.cs
@@ -1,4 +1,5 @@
 \ufeffusing System;
+using System.Linq;
 using System.Reflection;
 
 namespace Lucene.Net.Util
@@ -44,10 +45,10 @@ namespace Lucene.Net.Util
         {
             return
                 type != null &&
-                type.IsPublic &&
-                !type.IsAbstract &&
+                type.GetTypeInfo().IsPublic &&
+                !type.GetTypeInfo().IsAbstract &&
                 typeof(TService).GetTypeInfo().IsAssignableFrom(type) &&
-                type.GetCustomAttributes(typeof(IgnoreServiceAttribute), inherit: true).Length == 0;
+                type.GetTypeInfo().GetCustomAttribute<IgnoreServiceAttribute>(inherit: true) == null;
         }
 
         /// <summary>
@@ -57,11 +58,11 @@ namespace Lucene.Net.Util
         /// <returns>The canonical name of the service or the name provided in the corresponding name attribute, if supplied.</returns>
         public static string GetServiceName(Type type)
         {
-            // Check for CodecName attribute
-            object[] nameAttributes = type.GetCustomAttributes(typeof(ServiceNameAttribute), inherit: true);
-            if (nameAttributes.Length > 0)
+            // Check for ServiceName attribute
+            var nameAttributes = type.GetTypeInfo().GetCustomAttributes(typeof(ServiceNameAttribute), inherit: true);
+            if (nameAttributes.Any())
             {
-                ServiceNameAttribute nameAttribute = nameAttributes[0] as ServiceNameAttribute;
+                ServiceNameAttribute nameAttribute = nameAttributes.FirstOrDefault() as ServiceNameAttribute;
                 if (nameAttribute != null)
                 {
                     string name = nameAttribute.Name;


[03/20] lucenenet git commit: Lucene.Net.TestFramework: Implemented MockRandomPostingsFormat

Posted by ni...@apache.org.
Lucene.Net.TestFramework: Implemented MockRandomPostingsFormat


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

Branch: refs/heads/api-work
Commit: 28efcab967597f1cc79e88bfbb5736254adb1679
Parents: 5107574
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Mon Feb 27 23:14:22 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Mon Feb 27 23:20:00 2017 +0700

----------------------------------------------------------------------
 .../MockRandom/MockRandomPostingsFormat.cs      | 577 +++++++++++++++++++
 .../Lucene.Net.TestFramework.csproj             |   1 +
 .../Util/TestRuleSetupAndRestoreClassEnv.cs     |  10 +-
 3 files changed, 583 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/28efcab9/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs
new file mode 100644
index 0000000..d2f39c5
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs
@@ -0,0 +1,577 @@
+\ufeffusing Lucene.Net.Codecs.BlockTerms;
+using Lucene.Net.Codecs.Lucene41;
+using Lucene.Net.Codecs.Memory;
+using Lucene.Net.Codecs.MockIntBlock;
+using Lucene.Net.Codecs.MockSep;
+using Lucene.Net.Codecs.Pulsing;
+using Lucene.Net.Codecs.Sep;
+using Lucene.Net.Index;
+using Lucene.Net.Store;
+using Lucene.Net.Util;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace Lucene.Net.Codecs.MockRandom
+{
+    /// <summary>
+    /// Randomly combines terms index impl w/ postings impls.
+    /// </summary>
+    [PostingsFormatName("MockRandom")]
+    public sealed class MockRandomPostingsFormat : PostingsFormat
+    {
+        private readonly Random seedRandom;
+        private readonly string SEED_EXT = "sd";
+
+        private class RandomAnonymousClassHelper : Random
+        {
+            public RandomAnonymousClassHelper()
+                : base(0)
+            {
+            }
+
+            public override int Next(int maxValue)
+            {
+                throw new InvalidOperationException("Please use MockRandomPostingsFormat(Random)");
+            }
+        }
+
+        public MockRandomPostingsFormat()
+                  : this(null)
+        {
+            // This ctor should *only* be used at read-time: get NPE if you use it!
+        }
+
+        public MockRandomPostingsFormat(Random random)
+            : base()
+        {
+            if (random == null)
+            {
+                this.seedRandom = new RandomAnonymousClassHelper();
+                //            this.seedRandom = new Random(0) {
+
+                //    protected override int Next(int arg0)
+                //    {
+                //        throw new IllegalStateException("Please use MockRandomPostingsFormat(Random)");
+                //    }
+                //};
+            }
+            else
+            {
+                this.seedRandom = new Random(random.Next());
+            }
+        }
+
+        // Chooses random IntStreamFactory depending on file's extension
+        private class MockInt32StreamFactory : Int32StreamFactory
+        {
+            private readonly int salt;
+            private readonly IList<Int32StreamFactory> delegates = new List<Int32StreamFactory>();
+
+            public MockInt32StreamFactory(Random random)
+            {
+                salt = random.nextInt();
+                delegates.Add(new MockSingleIntFactory());
+                int blockSize = TestUtil.NextInt(random, 1, 2000);
+                delegates.Add(new MockFixedIntBlockPostingsFormat.MockIntFactory(blockSize));
+                int baseBlockSize = TestUtil.NextInt(random, 1, 127);
+                delegates.Add(new MockVariableIntBlockPostingsFormat.MockIntFactory(baseBlockSize));
+                // TODO: others
+            }
+
+            private static String getExtension(String fileName)
+            {
+                int idx = fileName.IndexOf('.');
+                Debug.Assert(idx != -1);
+                return fileName.Substring(idx);
+            }
+
+
+            public override Int32IndexInput OpenInput(Directory dir, string fileName, IOContext context)
+            {
+                // Must only use extension, because IW.addIndexes can
+                // rename segment!
+                Int32StreamFactory f = delegates[(Math.Abs(salt ^ getExtension(fileName).GetHashCode())) % delegates.size()];
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: read using int factory " + f + " from fileName=" + fileName);
+                }
+                return f.OpenInput(dir, fileName, context);
+            }
+
+            public override Int32IndexOutput CreateOutput(Directory dir, string fileName, IOContext context)
+            {
+                Int32StreamFactory f = delegates[(Math.Abs(salt ^ getExtension(fileName).GetHashCode())) % delegates.size()];
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: write using int factory " + f + " to fileName=" + fileName);
+                }
+                return f.CreateOutput(dir, fileName, context);
+            }
+        }
+
+        private class IndexTermSelectorAnonymousHelper : VariableGapTermsIndexWriter.IndexTermSelector
+        {
+            private readonly Random rand;
+            private readonly int gap;
+            public IndexTermSelectorAnonymousHelper(int seed, int gap)
+            {
+                rand = new Random(seed);
+                this.gap = gap;
+            }
+            public override bool IsIndexTerm(BytesRef term, TermStats stats)
+            {
+                return rand.Next(gap) == gap / 2;
+            }
+
+            public override void NewField(FieldInfo fieldInfo)
+            {
+            }
+        }
+
+        public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
+        {
+            int minSkipInterval;
+            if (state.SegmentInfo.DocCount > 1000000)
+            {
+                // Test2BPostings can OOME otherwise:
+                minSkipInterval = 3;
+            }
+            else
+            {
+                minSkipInterval = 2;
+            }
+
+            // we pull this before the seed intentionally: because its not consumed at runtime
+            // (the skipInterval is written into postings header)
+            int skipInterval = TestUtil.NextInt(seedRandom, minSkipInterval, 10);
+
+            if (LuceneTestCase.VERBOSE)
+            {
+                Console.WriteLine("MockRandomCodec: skipInterval=" + skipInterval);
+            }
+
+            long seed = seedRandom.nextLong();
+
+            if (LuceneTestCase.VERBOSE)
+            {
+                Console.WriteLine("MockRandomCodec: writing to seg=" + state.SegmentInfo.Name + " formatID=" + state.SegmentSuffix + " seed=" + seed);
+            }
+
+            string seedFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, SEED_EXT);
+            IndexOutput @out = state.Directory.CreateOutput(seedFileName, state.Context);
+            try
+            {
+                @out.WriteInt64(seed);
+            }
+            finally
+            {
+                @out.Dispose();
+            }
+
+            Random random = new Random((int)seed);
+
+            random.nextInt(); // consume a random for buffersize
+
+            PostingsWriterBase postingsWriter;
+            if (random.nextBoolean())
+            {
+                postingsWriter = new SepPostingsWriter(state, new MockInt32StreamFactory(random), skipInterval);
+            }
+            else
+            {
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: writing Standard postings");
+                }
+                // TODO: randomize variables like acceptibleOverHead?!
+                postingsWriter = new Lucene41PostingsWriter(state, skipInterval);
+            }
+
+            if (random.nextBoolean())
+            {
+                int totTFCutoff = TestUtil.NextInt(random, 1, 20);
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: writing pulsing postings with totTFCutoff=" + totTFCutoff);
+                }
+                postingsWriter = new PulsingPostingsWriter(state, totTFCutoff, postingsWriter);
+            }
+
+            FieldsConsumer fields;
+            int t1 = random.nextInt(4);
+
+            if (t1 == 0)
+            {
+                bool success = false;
+                try
+                {
+                    fields = new FSTTermsWriter(state, postingsWriter);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsWriter.Dispose();
+                    }
+                }
+            }
+            else if (t1 == 1)
+            {
+                bool success = false;
+                try
+                {
+                    fields = new FSTOrdTermsWriter(state, postingsWriter);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsWriter.Dispose();
+                    }
+                }
+            }
+            else if (t1 == 2)
+            {
+                // Use BlockTree terms dict
+
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: writing BlockTree terms dict");
+                }
+
+                // TODO: would be nice to allow 1 but this is very
+                // slow to write
+                int minTermsInBlock = TestUtil.NextInt(random, 2, 100);
+                int maxTermsInBlock = Math.Max(2, (minTermsInBlock - 1) * 2 + random.nextInt(100));
+
+                bool success = false;
+                try
+                {
+                    fields = new BlockTreeTermsWriter(state, postingsWriter, minTermsInBlock, maxTermsInBlock);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsWriter.Dispose();
+                    }
+                }
+            }
+            else
+            {
+
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: writing Block terms dict");
+                }
+
+                bool success = false;
+
+                TermsIndexWriterBase indexWriter;
+                try
+                {
+                    if (random.nextBoolean())
+                    {
+                        state.TermIndexInterval = TestUtil.NextInt(random, 1, 100);
+                        if (LuceneTestCase.VERBOSE)
+                        {
+                            Console.WriteLine("MockRandomCodec: fixed-gap terms index (tii=" + state.TermIndexInterval + ")");
+                        }
+                        indexWriter = new FixedGapTermsIndexWriter(state);
+                    }
+                    else
+                    {
+                        VariableGapTermsIndexWriter.IndexTermSelector selector;
+                        int n2 = random.nextInt(3);
+                        if (n2 == 0)
+                        {
+                            int tii = TestUtil.NextInt(random, 1, 100);
+                            selector = new VariableGapTermsIndexWriter.EveryNTermSelector(tii);
+                            if (LuceneTestCase.VERBOSE)
+                            {
+                                Console.WriteLine("MockRandomCodec: variable-gap terms index (tii=" + tii + ")");
+                            }
+                        }
+                        else if (n2 == 1)
+                        {
+                            int docFreqThresh = TestUtil.NextInt(random, 2, 100);
+                            int tii = TestUtil.NextInt(random, 1, 100);
+                            selector = new VariableGapTermsIndexWriter.EveryNOrDocFreqTermSelector(docFreqThresh, tii);
+                        }
+                        else
+                        {
+                            int seed2 = random.Next();
+                            int gap = TestUtil.NextInt(random, 2, 40);
+                            if (LuceneTestCase.VERBOSE)
+                            {
+                                Console.WriteLine("MockRandomCodec: random-gap terms index (max gap=" + gap + ")");
+                            }
+                            selector = new IndexTermSelectorAnonymousHelper(seed2, gap);
+
+                            //           selector = new VariableGapTermsIndexWriter.IndexTermSelector() {
+                            //                Random rand = new Random(seed2);
+
+                            //@Override
+                            //                public bool isIndexTerm(BytesRef term, TermStats stats)
+                            //{
+                            //    return rand.nextInt(gap) == gap / 2;
+                            //}
+
+                            //@Override
+                            //                  public void newField(FieldInfo fieldInfo)
+                            //{
+                            //}
+                            //              };
+                        }
+                        indexWriter = new VariableGapTermsIndexWriter(state, selector);
+                    }
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsWriter.Dispose();
+                    }
+                }
+
+                success = false;
+                try
+                {
+                    fields = new BlockTermsWriter(indexWriter, state, postingsWriter);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        try
+                        {
+                            postingsWriter.Dispose();
+                        }
+                        finally
+                        {
+                            indexWriter.Dispose();
+                        }
+                    }
+                }
+            }
+
+            return fields;
+        }
+
+        public override FieldsProducer FieldsProducer(SegmentReadState state)
+        {
+
+            string seedFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, SEED_EXT);
+            IndexInput @in = state.Directory.OpenInput(seedFileName, state.Context);
+            long seed = @in.ReadInt64();
+            if (LuceneTestCase.VERBOSE)
+            {
+                Console.WriteLine("MockRandomCodec: reading from seg=" + state.SegmentInfo.Name + " formatID=" + state.SegmentSuffix + " seed=" + seed);
+            }
+            @in.Dispose();
+
+            Random random = new Random((int)seed);
+
+            int readBufferSize = TestUtil.NextInt(random, 1, 4096);
+            if (LuceneTestCase.VERBOSE)
+            {
+                Console.WriteLine("MockRandomCodec: readBufferSize=" + readBufferSize);
+            }
+
+            PostingsReaderBase postingsReader;
+
+            if (random.nextBoolean())
+            {
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: reading Sep postings");
+                }
+                postingsReader = new SepPostingsReader(state.Directory, state.FieldInfos, state.SegmentInfo,
+                                                       state.Context, new MockInt32StreamFactory(random), state.SegmentSuffix);
+            }
+            else
+            {
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: reading Standard postings");
+                }
+                postingsReader = new Lucene41PostingsReader(state.Directory, state.FieldInfos, state.SegmentInfo, state.Context, state.SegmentSuffix);
+            }
+
+            if (random.nextBoolean())
+            {
+                int totTFCutoff = TestUtil.NextInt(random, 1, 20);
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: reading pulsing postings with totTFCutoff=" + totTFCutoff);
+                }
+                postingsReader = new PulsingPostingsReader(state, postingsReader);
+            }
+
+            FieldsProducer fields;
+            int t1 = random.nextInt(4);
+            if (t1 == 0)
+            {
+                bool success = false;
+                try
+                {
+                    fields = new FSTTermsReader(state, postingsReader);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsReader.Dispose();
+                    }
+                }
+            }
+            else if (t1 == 1)
+            {
+                bool success = false;
+                try
+                {
+                    fields = new FSTOrdTermsReader(state, postingsReader);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsReader.Dispose();
+                    }
+                }
+            }
+            else if (t1 == 2)
+            {
+                // Use BlockTree terms dict
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: reading BlockTree terms dict");
+                }
+
+                bool success = false;
+                try
+                {
+                    fields = new BlockTreeTermsReader(state.Directory,
+                                                      state.FieldInfos,
+                                                      state.SegmentInfo,
+                                                      postingsReader,
+                                                      state.Context,
+                                                      state.SegmentSuffix,
+                                                      state.TermsIndexDivisor);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsReader.Dispose();
+                    }
+                }
+            }
+            else
+            {
+
+                if (LuceneTestCase.VERBOSE)
+                {
+                    Console.WriteLine("MockRandomCodec: reading Block terms dict");
+                }
+                TermsIndexReaderBase indexReader;
+                bool success = false;
+                try
+                {
+                    bool doFixedGap = random.nextBoolean();
+
+                    // randomness diverges from writer, here:
+                    if (state.TermsIndexDivisor != -1)
+                    {
+                        state.TermsIndexDivisor = TestUtil.NextInt(random, 1, 10);
+                    }
+
+                    if (doFixedGap)
+                    {
+                        // if termsIndexDivisor is set to -1, we should not touch it. It means a
+                        // test explicitly instructed not to load the terms index.
+                        if (LuceneTestCase.VERBOSE)
+                        {
+                            Console.WriteLine("MockRandomCodec: fixed-gap terms index (divisor=" + state.TermsIndexDivisor + ")");
+                        }
+                        indexReader = new FixedGapTermsIndexReader(state.Directory,
+                                                                   state.FieldInfos,
+                                                                   state.SegmentInfo.Name,
+                                                                   state.TermsIndexDivisor,
+                                                                   BytesRef.UTF8SortedAsUnicodeComparer,
+                                                                   state.SegmentSuffix, state.Context);
+                    }
+                    else
+                    {
+                        int n2 = random.nextInt(3);
+                        if (n2 == 1)
+                        {
+                            random.nextInt();
+                        }
+                        else if (n2 == 2)
+                        {
+                            random.nextLong();
+                        }
+                        if (LuceneTestCase.VERBOSE)
+                        {
+                            Console.WriteLine("MockRandomCodec: variable-gap terms index (divisor=" + state.TermsIndexDivisor + ")");
+                        }
+                        indexReader = new VariableGapTermsIndexReader(state.Directory,
+                                                                      state.FieldInfos,
+                                                                      state.SegmentInfo.Name,
+                                                                      state.TermsIndexDivisor,
+                                                                      state.SegmentSuffix, state.Context);
+
+                    }
+
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        postingsReader.Dispose();
+                    }
+                }
+
+                success = false;
+                try
+                {
+                    fields = new BlockTermsReader(indexReader,
+                                                  state.Directory,
+                                                  state.FieldInfos,
+                                                  state.SegmentInfo,
+                                                  postingsReader,
+                                                  state.Context,
+                                                  state.SegmentSuffix);
+                    success = true;
+                }
+                finally
+                {
+                    if (!success)
+                    {
+                        try
+                        {
+                            postingsReader.Dispose();
+                        }
+                        finally
+                        {
+                            indexReader.Dispose();
+                        }
+                    }
+                }
+            }
+
+            return fields;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/28efcab9/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index f008111..c972f03 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -252,6 +252,7 @@
     </Compile>
     <Compile Include="Codecs\MockIntBlock\MockFixedIntBlockPostingsFormat.cs" />
     <Compile Include="Codecs\MockIntBlock\MockVariableIntBlockPostingsFormat.cs" />
+    <Compile Include="Codecs\MockRandom\MockRandomPostingsFormat.cs" />
     <Compile Include="Codecs\MockSep\MockSepPostingsFormat.cs" />
     <Compile Include="Codecs\MockSep\MockSingleIntFactory.cs" />
     <Compile Include="Codecs\MockSep\MockSingleIntIndexInput.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/28efcab9/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index 797d974..0a34665 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -14,6 +14,7 @@ namespace Lucene.Net.Util
     using Codecs.Lucene41;
     using Codecs.Lucene42;
     using Codecs.Lucene45;
+    using Codecs.MockRandom;
     using Codecs.SimpleText;
     using JavaCompatibility;
     //using AssumptionViolatedException = org.junit.@internal.AssumptionViolatedException;
@@ -195,11 +196,10 @@ namespace Lucene.Net.Util
                 {
                     format = PostingsFormat.ForName("Lucene41");
                 }
-                // LUCENENET TODO: Implement MockRandomPostingsFormat
-                //else if ("MockRandom".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
-                //{
-                //    format = new MockRandomPostingsFormat(new Random(random.Next()));
-                //}
+                else if ("MockRandom".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
+                {
+                    format = new MockRandomPostingsFormat(new Random(random.Next()));
+                }
                 else
                 {
                     format = PostingsFormat.ForName(LuceneTestCase.TEST_POSTINGSFORMAT);


[17/20] lucenenet git commit: Lucene.Net.Tests.Expressions: Fixed namespaces and usings

Posted by ni...@apache.org.
Lucene.Net.Tests.Expressions: Fixed namespaces and usings


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

Branch: refs/heads/api-work
Commit: 51e3957ccbf5b753449b43ad4611936af8481042
Parents: 3ad36c4
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 18:24:23 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 18:24:23 2017 +0700

----------------------------------------------------------------------
 .../JS/TestCustomFunctions.cs                   |  13 +-
 .../JS/TestJavascriptCompiler.cs                |   8 +-
 .../JS/TestJavascriptFunction.cs                | 557 +++++++++----------
 .../JS/TestJavascriptOperations.cs              |   7 +-
 .../Lucene.Net.Tests.Expressions.csproj         |   2 +-
 .../TestApiConsistency.cs                       |   2 +-
 .../TestDemoExpressions.cs                      |  11 +-
 .../TestExpressionRescorer.cs                   |   6 +-
 .../TestExpressionSortField.cs                  |   6 +-
 .../TestExpressionSorts.cs                      |   5 +-
 .../TestExpressionValidation.cs                 |  10 +-
 .../TestExpressionValueSource.cs                |   8 +-
 12 files changed, 315 insertions(+), 320 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
index 22e8f12..8d98e35 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
@@ -1,16 +1,15 @@
+using Lucene.Net.Support;
+using Lucene.Net.Util;
+using NUnit.Framework;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Linq.Expressions;
 using System.Reflection;
-using Lucene.Net.Expressions.JS;
-using Lucene.Net.Support;
-using NUnit.Framework;
 
-namespace Lucene.Net.Tests.Expressions.JS
+namespace Lucene.Net.Expressions.JS
 {
-	[TestFixture]
-	public class TestCustomFunctions : Util.LuceneTestCase
+    [TestFixture]
+	public class TestCustomFunctions : LuceneTestCase
 	{
 		private static double DELTA = 0.0000001;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
index 41da6b3..730e057 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
@@ -1,10 +1,10 @@
-using System;
-using Lucene.Net.Expressions.JS;
+using Lucene.Net.Util;
 using NUnit.Framework;
+using System;
 
-namespace Lucene.Net.Tests.Expressions.JS
+namespace Lucene.Net.Expressions.JS
 {
-	public class TestJavascriptCompiler : Util.LuceneTestCase
+    public class TestJavascriptCompiler : LuceneTestCase
 	{
 		[Test]
 		public virtual void TestValidCompiles()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
index 3d39f1d..66f6bab 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
@@ -1,309 +1,308 @@
-using System;
-using Lucene.Net.Expressions;
-using Lucene.Net.Expressions.JS;
+using Lucene.Net.Util;
 using NUnit.Framework;
+using System;
 
-namespace Lucene.Net.Tests.Expressions.JS
+namespace Lucene.Net.Expressions.JS
 {
-	public class TestJavascriptFunction : Util.LuceneTestCase
-	{
-		private static double DELTA = 0.0000001;
+    public class TestJavascriptFunction : LuceneTestCase
+    {
+        private static double DELTA = 0.0000001;
+
 
-		
-		private void AssertEvaluatesTo(string expression, double expected)
-		{
-			Expression evaluator = JavascriptCompiler.Compile(expression);
-			double actual = evaluator.Evaluate(0, null);
-			AreEqual(expected, actual, DELTA);
-		}
+        private void AssertEvaluatesTo(string expression, double expected)
+        {
+            Expression evaluator = JavascriptCompiler.Compile(expression);
+            double actual = evaluator.Evaluate(0, null);
+            AreEqual(expected, actual, DELTA);
+        }
 
-		[Test]
-		public virtual void TestAbsMethod()
-		{
-			AssertEvaluatesTo("abs(0)", 0);
-			AssertEvaluatesTo("abs(119)", 119);
-			AssertEvaluatesTo("abs(119)", 119);
-			AssertEvaluatesTo("abs(1)", 1);
-			AssertEvaluatesTo("abs(-1)", 1);
-		}
+        [Test]
+        public virtual void TestAbsMethod()
+        {
+            AssertEvaluatesTo("abs(0)", 0);
+            AssertEvaluatesTo("abs(119)", 119);
+            AssertEvaluatesTo("abs(119)", 119);
+            AssertEvaluatesTo("abs(1)", 1);
+            AssertEvaluatesTo("abs(-1)", 1);
+        }
 
-		[Test]
-		public virtual void TestAcosMethod()
-		{
-			AssertEvaluatesTo("acos(-1)", Math.PI);
-			AssertEvaluatesTo("acos(-0.8660254)", Math.PI * 5 / 6);
-			AssertEvaluatesTo("acos(-0.7071068)", Math.PI * 3 / 4);
-			AssertEvaluatesTo("acos(-0.5)", Math.PI * 2 / 3);
-			AssertEvaluatesTo("acos(0)", Math.PI / 2);
-			AssertEvaluatesTo("acos(0.5)", Math.PI / 3);
-			AssertEvaluatesTo("acos(0.7071068)", Math.PI / 4);
-			AssertEvaluatesTo("acos(0.8660254)", Math.PI / 6);
-			AssertEvaluatesTo("acos(1)", 0);
-		}
+        [Test]
+        public virtual void TestAcosMethod()
+        {
+            AssertEvaluatesTo("acos(-1)", Math.PI);
+            AssertEvaluatesTo("acos(-0.8660254)", Math.PI * 5 / 6);
+            AssertEvaluatesTo("acos(-0.7071068)", Math.PI * 3 / 4);
+            AssertEvaluatesTo("acos(-0.5)", Math.PI * 2 / 3);
+            AssertEvaluatesTo("acos(0)", Math.PI / 2);
+            AssertEvaluatesTo("acos(0.5)", Math.PI / 3);
+            AssertEvaluatesTo("acos(0.7071068)", Math.PI / 4);
+            AssertEvaluatesTo("acos(0.8660254)", Math.PI / 6);
+            AssertEvaluatesTo("acos(1)", 0);
+        }
 
-		[Test]
-		public virtual void TestAcoshMethod()
-		{
-			AssertEvaluatesTo("acosh(1)", 0);
-			AssertEvaluatesTo("acosh(2.5)", 1.5667992369724109);
-			AssertEvaluatesTo("acosh(1234567.89)", 14.719378760739708);
-		}
+        [Test]
+        public virtual void TestAcoshMethod()
+        {
+            AssertEvaluatesTo("acosh(1)", 0);
+            AssertEvaluatesTo("acosh(2.5)", 1.5667992369724109);
+            AssertEvaluatesTo("acosh(1234567.89)", 14.719378760739708);
+        }
 
-		[Test]
-		public virtual void TestAsinMethod()
-		{
-			AssertEvaluatesTo("asin(-1)", -Math.PI / 2);
-			AssertEvaluatesTo("asin(-0.8660254)", -Math.PI / 3);
-			AssertEvaluatesTo("asin(-0.7071068)", -Math.PI / 4);
-			AssertEvaluatesTo("asin(-0.5)", -Math.PI / 6);
-			AssertEvaluatesTo("asin(0)", 0);
-			AssertEvaluatesTo("asin(0.5)", Math.PI / 6);
-			AssertEvaluatesTo("asin(0.7071068)", Math.PI / 4);
-			AssertEvaluatesTo("asin(0.8660254)", Math.PI / 3);
-			AssertEvaluatesTo("asin(1)", Math.PI / 2);
-		}
+        [Test]
+        public virtual void TestAsinMethod()
+        {
+            AssertEvaluatesTo("asin(-1)", -Math.PI / 2);
+            AssertEvaluatesTo("asin(-0.8660254)", -Math.PI / 3);
+            AssertEvaluatesTo("asin(-0.7071068)", -Math.PI / 4);
+            AssertEvaluatesTo("asin(-0.5)", -Math.PI / 6);
+            AssertEvaluatesTo("asin(0)", 0);
+            AssertEvaluatesTo("asin(0.5)", Math.PI / 6);
+            AssertEvaluatesTo("asin(0.7071068)", Math.PI / 4);
+            AssertEvaluatesTo("asin(0.8660254)", Math.PI / 3);
+            AssertEvaluatesTo("asin(1)", Math.PI / 2);
+        }
 
-		[Test]
-		public virtual void TestAsinhMethod()
-		{
-			AssertEvaluatesTo("asinh(-1234567.89)", -14.719378760740035);
-			AssertEvaluatesTo("asinh(-2.5)", -1.6472311463710958);
-			AssertEvaluatesTo("asinh(-1)", -0.8813735870195429);
-			AssertEvaluatesTo("asinh(0)", 0);
-			AssertEvaluatesTo("asinh(1)", 0.8813735870195429);
-			AssertEvaluatesTo("asinh(2.5)", 1.6472311463710958);
-			AssertEvaluatesTo("asinh(1234567.89)", 14.719378760740035);
-		}
+        [Test]
+        public virtual void TestAsinhMethod()
+        {
+            AssertEvaluatesTo("asinh(-1234567.89)", -14.719378760740035);
+            AssertEvaluatesTo("asinh(-2.5)", -1.6472311463710958);
+            AssertEvaluatesTo("asinh(-1)", -0.8813735870195429);
+            AssertEvaluatesTo("asinh(0)", 0);
+            AssertEvaluatesTo("asinh(1)", 0.8813735870195429);
+            AssertEvaluatesTo("asinh(2.5)", 1.6472311463710958);
+            AssertEvaluatesTo("asinh(1234567.89)", 14.719378760740035);
+        }
 
-		[Test]
-		public virtual void TestAtanMethod()
-		{
-			AssertEvaluatesTo("atan(-1.732050808)", -Math.PI / 3);
-			AssertEvaluatesTo("atan(-1)", -Math.PI / 4);
-			AssertEvaluatesTo("atan(-0.577350269)", -Math.PI / 6);
-			AssertEvaluatesTo("atan(0)", 0);
-			AssertEvaluatesTo("atan(0.577350269)", Math.PI / 6);
-			AssertEvaluatesTo("atan(1)", Math.PI / 4);
-			AssertEvaluatesTo("atan(1.732050808)", Math.PI / 3);
-		}
+        [Test]
+        public virtual void TestAtanMethod()
+        {
+            AssertEvaluatesTo("atan(-1.732050808)", -Math.PI / 3);
+            AssertEvaluatesTo("atan(-1)", -Math.PI / 4);
+            AssertEvaluatesTo("atan(-0.577350269)", -Math.PI / 6);
+            AssertEvaluatesTo("atan(0)", 0);
+            AssertEvaluatesTo("atan(0.577350269)", Math.PI / 6);
+            AssertEvaluatesTo("atan(1)", Math.PI / 4);
+            AssertEvaluatesTo("atan(1.732050808)", Math.PI / 3);
+        }
 
-		[Test]
-		public virtual void TestAtan2Method()
-		{
-			AssertEvaluatesTo("atan2(+0,+0)", +0.0);
-			AssertEvaluatesTo("atan2(+0,-0)", +Math.PI);
-			AssertEvaluatesTo("atan2(-0,+0)", -0.0);
-			AssertEvaluatesTo("atan2(-0,-0)", -Math.PI);
-			AssertEvaluatesTo("atan2(2,2)", Math.PI / 4);
-			AssertEvaluatesTo("atan2(-2,2)", -Math.PI / 4);
-			AssertEvaluatesTo("atan2(2,-2)", Math.PI * 3 / 4);
-			AssertEvaluatesTo("atan2(-2,-2)", -Math.PI * 3 / 4);
-		}
+        [Test]
+        public virtual void TestAtan2Method()
+        {
+            AssertEvaluatesTo("atan2(+0,+0)", +0.0);
+            AssertEvaluatesTo("atan2(+0,-0)", +Math.PI);
+            AssertEvaluatesTo("atan2(-0,+0)", -0.0);
+            AssertEvaluatesTo("atan2(-0,-0)", -Math.PI);
+            AssertEvaluatesTo("atan2(2,2)", Math.PI / 4);
+            AssertEvaluatesTo("atan2(-2,2)", -Math.PI / 4);
+            AssertEvaluatesTo("atan2(2,-2)", Math.PI * 3 / 4);
+            AssertEvaluatesTo("atan2(-2,-2)", -Math.PI * 3 / 4);
+        }
 
-		[Test]
-		public virtual void TestAtanhMethod()
-		{
-			AssertEvaluatesTo("atanh(-1)", double.NegativeInfinity);
-			AssertEvaluatesTo("atanh(-0.5)", -0.5493061443340549);
-			AssertEvaluatesTo("atanh(0)", 0);
-			AssertEvaluatesTo("atanh(0.5)", 0.5493061443340549);
-			AssertEvaluatesTo("atanh(1)", double.PositiveInfinity);
-		}
+        [Test]
+        public virtual void TestAtanhMethod()
+        {
+            AssertEvaluatesTo("atanh(-1)", double.NegativeInfinity);
+            AssertEvaluatesTo("atanh(-0.5)", -0.5493061443340549);
+            AssertEvaluatesTo("atanh(0)", 0);
+            AssertEvaluatesTo("atanh(0.5)", 0.5493061443340549);
+            AssertEvaluatesTo("atanh(1)", double.PositiveInfinity);
+        }
 
-		[Test]
-		public virtual void TestCeilMethod()
-		{
-			AssertEvaluatesTo("ceil(0)", 0);
-			AssertEvaluatesTo("ceil(0.1)", 1);
-			AssertEvaluatesTo("ceil(0.9)", 1);
-			AssertEvaluatesTo("ceil(25.2)", 26);
-			AssertEvaluatesTo("ceil(-0.1)", 0);
-			AssertEvaluatesTo("ceil(-0.9)", 0);
-			AssertEvaluatesTo("ceil(-1.1)", -1);
-		}
+        [Test]
+        public virtual void TestCeilMethod()
+        {
+            AssertEvaluatesTo("ceil(0)", 0);
+            AssertEvaluatesTo("ceil(0.1)", 1);
+            AssertEvaluatesTo("ceil(0.9)", 1);
+            AssertEvaluatesTo("ceil(25.2)", 26);
+            AssertEvaluatesTo("ceil(-0.1)", 0);
+            AssertEvaluatesTo("ceil(-0.9)", 0);
+            AssertEvaluatesTo("ceil(-1.1)", -1);
+        }
 
-		[Test]
-		public virtual void TestCosMethod()
-		{
-			AssertEvaluatesTo("cos(0)", 1);
-			AssertEvaluatesTo("cos(" + Math.PI / 2 + ")", 0);
-			AssertEvaluatesTo("cos(" + -Math.PI / 2 + ")", 0);
-			AssertEvaluatesTo("cos(" + Math.PI / 4 + ")", 0.7071068);
-			AssertEvaluatesTo("cos(" + -Math.PI / 4 + ")", 0.7071068);
-			AssertEvaluatesTo("cos(" + Math.PI * 2 / 3 + ")", -0.5);
-			AssertEvaluatesTo("cos(" + -Math.PI * 2 / 3 + ")", -0.5);
-			AssertEvaluatesTo("cos(" + Math.PI / 6 + ")", 0.8660254);
-			AssertEvaluatesTo("cos(" + -Math.PI / 6 + ")", 0.8660254);
-		}
+        [Test]
+        public virtual void TestCosMethod()
+        {
+            AssertEvaluatesTo("cos(0)", 1);
+            AssertEvaluatesTo("cos(" + Math.PI / 2 + ")", 0);
+            AssertEvaluatesTo("cos(" + -Math.PI / 2 + ")", 0);
+            AssertEvaluatesTo("cos(" + Math.PI / 4 + ")", 0.7071068);
+            AssertEvaluatesTo("cos(" + -Math.PI / 4 + ")", 0.7071068);
+            AssertEvaluatesTo("cos(" + Math.PI * 2 / 3 + ")", -0.5);
+            AssertEvaluatesTo("cos(" + -Math.PI * 2 / 3 + ")", -0.5);
+            AssertEvaluatesTo("cos(" + Math.PI / 6 + ")", 0.8660254);
+            AssertEvaluatesTo("cos(" + -Math.PI / 6 + ")", 0.8660254);
+        }
 
-		[Test]
-		public virtual void TestCoshMethod()
-		{
-			AssertEvaluatesTo("cosh(0)", 1);
-			AssertEvaluatesTo("cosh(-1)", 1.5430806348152437);
-			AssertEvaluatesTo("cosh(1)", 1.5430806348152437);
-			AssertEvaluatesTo("cosh(-0.5)", 1.1276259652063807);
-			AssertEvaluatesTo("cosh(0.5)", 1.1276259652063807);
-			AssertEvaluatesTo("cosh(-12.3456789)", 114982.09728671524);
-			AssertEvaluatesTo("cosh(12.3456789)", 114982.09728671524);
-		}
+        [Test]
+        public virtual void TestCoshMethod()
+        {
+            AssertEvaluatesTo("cosh(0)", 1);
+            AssertEvaluatesTo("cosh(-1)", 1.5430806348152437);
+            AssertEvaluatesTo("cosh(1)", 1.5430806348152437);
+            AssertEvaluatesTo("cosh(-0.5)", 1.1276259652063807);
+            AssertEvaluatesTo("cosh(0.5)", 1.1276259652063807);
+            AssertEvaluatesTo("cosh(-12.3456789)", 114982.09728671524);
+            AssertEvaluatesTo("cosh(12.3456789)", 114982.09728671524);
+        }
 
-		[Test]
-		public virtual void TestExpMethod()
-		{
-			AssertEvaluatesTo("exp(0)", 1);
-			AssertEvaluatesTo("exp(-1)", 0.36787944117);
-			AssertEvaluatesTo("exp(1)", 2.71828182846);
-			AssertEvaluatesTo("exp(-0.5)", 0.60653065971);
-			AssertEvaluatesTo("exp(0.5)", 1.6487212707);
-			AssertEvaluatesTo("exp(-12.3456789)", 0.0000043485);
-			AssertEvaluatesTo("exp(12.3456789)", 229964.194569);
-		}
+        [Test]
+        public virtual void TestExpMethod()
+        {
+            AssertEvaluatesTo("exp(0)", 1);
+            AssertEvaluatesTo("exp(-1)", 0.36787944117);
+            AssertEvaluatesTo("exp(1)", 2.71828182846);
+            AssertEvaluatesTo("exp(-0.5)", 0.60653065971);
+            AssertEvaluatesTo("exp(0.5)", 1.6487212707);
+            AssertEvaluatesTo("exp(-12.3456789)", 0.0000043485);
+            AssertEvaluatesTo("exp(12.3456789)", 229964.194569);
+        }
 
-		[Test]
-		public virtual void TestFloorMethod()
-		{
-			AssertEvaluatesTo("floor(0)", 0);
-			AssertEvaluatesTo("floor(0.1)", 0);
-			AssertEvaluatesTo("floor(0.9)", 0);
-			AssertEvaluatesTo("floor(25.2)", 25);
-			AssertEvaluatesTo("floor(-0.1)", -1);
-			AssertEvaluatesTo("floor(-0.9)", -1);
-			AssertEvaluatesTo("floor(-1.1)", -2);
-		}
+        [Test]
+        public virtual void TestFloorMethod()
+        {
+            AssertEvaluatesTo("floor(0)", 0);
+            AssertEvaluatesTo("floor(0.1)", 0);
+            AssertEvaluatesTo("floor(0.9)", 0);
+            AssertEvaluatesTo("floor(25.2)", 25);
+            AssertEvaluatesTo("floor(-0.1)", -1);
+            AssertEvaluatesTo("floor(-0.9)", -1);
+            AssertEvaluatesTo("floor(-1.1)", -2);
+        }
 
-		[Test]
-		public virtual void TestHaversinMethod()
-		{
-			AssertEvaluatesTo("haversin(40.7143528,-74.0059731,40.759011,-73.9844722)", 5.284299568309
-				);
-		}
+        [Test]
+        public virtual void TestHaversinMethod()
+        {
+            AssertEvaluatesTo("haversin(40.7143528,-74.0059731,40.759011,-73.9844722)", 5.284299568309
+                );
+        }
 
-		[Test]
-		public virtual void TestLnMethod()
-		{
-			AssertEvaluatesTo("ln(0)", double.NegativeInfinity);
-			AssertEvaluatesTo("ln(" + Math.E + ")", 1);
-			AssertEvaluatesTo("ln(-1)", double.NaN);
-			AssertEvaluatesTo("ln(1)", 0);
-			AssertEvaluatesTo("ln(0.5)", -0.69314718056);
-			AssertEvaluatesTo("ln(12.3456789)", 2.51330611521);
-		}
+        [Test]
+        public virtual void TestLnMethod()
+        {
+            AssertEvaluatesTo("ln(0)", double.NegativeInfinity);
+            AssertEvaluatesTo("ln(" + Math.E + ")", 1);
+            AssertEvaluatesTo("ln(-1)", double.NaN);
+            AssertEvaluatesTo("ln(1)", 0);
+            AssertEvaluatesTo("ln(0.5)", -0.69314718056);
+            AssertEvaluatesTo("ln(12.3456789)", 2.51330611521);
+        }
 
-		[Test]
-		public virtual void TestLog10Method()
-		{
-			AssertEvaluatesTo("log10(0)", double.NegativeInfinity);
-			AssertEvaluatesTo("log10(1)", 0);
-			AssertEvaluatesTo("log10(-1)", double.NaN);
-			AssertEvaluatesTo("log10(0.5)", -0.3010299956639812);
-			AssertEvaluatesTo("log10(12.3456789)", 1.0915149771692705);
-		}
+        [Test]
+        public virtual void TestLog10Method()
+        {
+            AssertEvaluatesTo("log10(0)", double.NegativeInfinity);
+            AssertEvaluatesTo("log10(1)", 0);
+            AssertEvaluatesTo("log10(-1)", double.NaN);
+            AssertEvaluatesTo("log10(0.5)", -0.3010299956639812);
+            AssertEvaluatesTo("log10(12.3456789)", 1.0915149771692705);
+        }
 
-		[Test]
-		public virtual void TestLognMethod()
-		{
-			AssertEvaluatesTo("logn(2, 0)", double.NegativeInfinity);
-			AssertEvaluatesTo("logn(2, 1)", 0);
-			AssertEvaluatesTo("logn(2, -1)", double.NaN);
-			AssertEvaluatesTo("logn(2, 0.5)", -1);
-			AssertEvaluatesTo("logn(2, 12.3456789)", 3.6259342686489378);
-			AssertEvaluatesTo("logn(2.5, 0)", double.NegativeInfinity);
-			AssertEvaluatesTo("logn(2.5, 1)", 0);
-			AssertEvaluatesTo("logn(2.5, -1)", double.NaN);
-			AssertEvaluatesTo("logn(2.5, 0.5)", -0.75647079736603);
-			AssertEvaluatesTo("logn(2.5, 12.3456789)", 2.7429133874016745);
-		}
+        [Test]
+        public virtual void TestLognMethod()
+        {
+            AssertEvaluatesTo("logn(2, 0)", double.NegativeInfinity);
+            AssertEvaluatesTo("logn(2, 1)", 0);
+            AssertEvaluatesTo("logn(2, -1)", double.NaN);
+            AssertEvaluatesTo("logn(2, 0.5)", -1);
+            AssertEvaluatesTo("logn(2, 12.3456789)", 3.6259342686489378);
+            AssertEvaluatesTo("logn(2.5, 0)", double.NegativeInfinity);
+            AssertEvaluatesTo("logn(2.5, 1)", 0);
+            AssertEvaluatesTo("logn(2.5, -1)", double.NaN);
+            AssertEvaluatesTo("logn(2.5, 0.5)", -0.75647079736603);
+            AssertEvaluatesTo("logn(2.5, 12.3456789)", 2.7429133874016745);
+        }
 
-		[Test]
-		public virtual void TestMaxMethod()
-		{
-			AssertEvaluatesTo("max(0, 0)", 0);
-			AssertEvaluatesTo("max(1, 0)", 1);
-			AssertEvaluatesTo("max(0, -1)", 0);
-			AssertEvaluatesTo("max(-1, 0)", 0);
-			AssertEvaluatesTo("max(25, 23)", 25);
-		}
+        [Test]
+        public virtual void TestMaxMethod()
+        {
+            AssertEvaluatesTo("max(0, 0)", 0);
+            AssertEvaluatesTo("max(1, 0)", 1);
+            AssertEvaluatesTo("max(0, -1)", 0);
+            AssertEvaluatesTo("max(-1, 0)", 0);
+            AssertEvaluatesTo("max(25, 23)", 25);
+        }
 
-		[Test]
-		public virtual void TestMinMethod()
-		{
-			AssertEvaluatesTo("min(0, 0)", 0);
-			AssertEvaluatesTo("min(1, 0)", 0);
-			AssertEvaluatesTo("min(0, -1)", -1);
-			AssertEvaluatesTo("min(-1, 0)", -1);
-			AssertEvaluatesTo("min(25, 23)", 23);
-		}
+        [Test]
+        public virtual void TestMinMethod()
+        {
+            AssertEvaluatesTo("min(0, 0)", 0);
+            AssertEvaluatesTo("min(1, 0)", 0);
+            AssertEvaluatesTo("min(0, -1)", -1);
+            AssertEvaluatesTo("min(-1, 0)", -1);
+            AssertEvaluatesTo("min(25, 23)", 23);
+        }
 
-		[Test]
-		public virtual void TestPowMethod()
-		{
-			AssertEvaluatesTo("pow(0, 0)", 1);
-			AssertEvaluatesTo("pow(0.1, 2)", 0.01);
-			AssertEvaluatesTo("pow(0.9, -1)", 1.1111111111111112);
-			AssertEvaluatesTo("pow(2.2, -2.5)", 0.13929749224447147);
-			AssertEvaluatesTo("pow(5, 3)", 125);
-			AssertEvaluatesTo("pow(-0.9, 5)", -0.59049);
-			AssertEvaluatesTo("pow(-1.1, 2)", 1.21);
-		}
+        [Test]
+        public virtual void TestPowMethod()
+        {
+            AssertEvaluatesTo("pow(0, 0)", 1);
+            AssertEvaluatesTo("pow(0.1, 2)", 0.01);
+            AssertEvaluatesTo("pow(0.9, -1)", 1.1111111111111112);
+            AssertEvaluatesTo("pow(2.2, -2.5)", 0.13929749224447147);
+            AssertEvaluatesTo("pow(5, 3)", 125);
+            AssertEvaluatesTo("pow(-0.9, 5)", -0.59049);
+            AssertEvaluatesTo("pow(-1.1, 2)", 1.21);
+        }
 
-		[Test]
-		public virtual void TestSinMethod()
-		{
-			AssertEvaluatesTo("sin(0)", 0);
-			AssertEvaluatesTo("sin(" + Math.PI / 2 + ")", 1);
-			AssertEvaluatesTo("sin(" + -Math.PI / 2 + ")", -1);
-			AssertEvaluatesTo("sin(" + Math.PI / 4 + ")", 0.7071068);
-			AssertEvaluatesTo("sin(" + -Math.PI / 4 + ")", -0.7071068);
-			AssertEvaluatesTo("sin(" + Math.PI * 2 / 3 + ")", 0.8660254);
-			AssertEvaluatesTo("sin(" + -Math.PI * 2 / 3 + ")", -0.8660254);
-			AssertEvaluatesTo("sin(" + Math.PI / 6 + ")", 0.5);
-			AssertEvaluatesTo("sin(" + -Math.PI / 6 + ")", -0.5);
-		}
+        [Test]
+        public virtual void TestSinMethod()
+        {
+            AssertEvaluatesTo("sin(0)", 0);
+            AssertEvaluatesTo("sin(" + Math.PI / 2 + ")", 1);
+            AssertEvaluatesTo("sin(" + -Math.PI / 2 + ")", -1);
+            AssertEvaluatesTo("sin(" + Math.PI / 4 + ")", 0.7071068);
+            AssertEvaluatesTo("sin(" + -Math.PI / 4 + ")", -0.7071068);
+            AssertEvaluatesTo("sin(" + Math.PI * 2 / 3 + ")", 0.8660254);
+            AssertEvaluatesTo("sin(" + -Math.PI * 2 / 3 + ")", -0.8660254);
+            AssertEvaluatesTo("sin(" + Math.PI / 6 + ")", 0.5);
+            AssertEvaluatesTo("sin(" + -Math.PI / 6 + ")", -0.5);
+        }
 
-		[Test]
-		public virtual void TestSinhMethod()
-		{
-			AssertEvaluatesTo("sinh(0)", 0);
-			AssertEvaluatesTo("sinh(-1)", -1.1752011936438014);
-			AssertEvaluatesTo("sinh(1)", 1.1752011936438014);
-			AssertEvaluatesTo("sinh(-0.5)", -0.52109530549);
-			AssertEvaluatesTo("sinh(0.5)", 0.52109530549);
-			AssertEvaluatesTo("sinh(-12.3456789)", -114982.09728236674);
-			AssertEvaluatesTo("sinh(12.3456789)", 114982.09728236674);
-		}
+        [Test]
+        public virtual void TestSinhMethod()
+        {
+            AssertEvaluatesTo("sinh(0)", 0);
+            AssertEvaluatesTo("sinh(-1)", -1.1752011936438014);
+            AssertEvaluatesTo("sinh(1)", 1.1752011936438014);
+            AssertEvaluatesTo("sinh(-0.5)", -0.52109530549);
+            AssertEvaluatesTo("sinh(0.5)", 0.52109530549);
+            AssertEvaluatesTo("sinh(-12.3456789)", -114982.09728236674);
+            AssertEvaluatesTo("sinh(12.3456789)", 114982.09728236674);
+        }
 
-		[Test]
-		public virtual void TestSqrtMethod()
-		{
-			AssertEvaluatesTo("sqrt(0)", 0);
-			AssertEvaluatesTo("sqrt(-1)", double.NaN);
-			AssertEvaluatesTo("sqrt(0.49)", 0.7);
-			AssertEvaluatesTo("sqrt(49)", 7);
-		}
+        [Test]
+        public virtual void TestSqrtMethod()
+        {
+            AssertEvaluatesTo("sqrt(0)", 0);
+            AssertEvaluatesTo("sqrt(-1)", double.NaN);
+            AssertEvaluatesTo("sqrt(0.49)", 0.7);
+            AssertEvaluatesTo("sqrt(49)", 7);
+        }
 
-		[Test]
-		public virtual void TestTanMethod()
-		{
-			AssertEvaluatesTo("tan(0)", 0);
-			AssertEvaluatesTo("tan(-1)", -1.55740772465);
-			AssertEvaluatesTo("tan(1)", 1.55740772465);
-			AssertEvaluatesTo("tan(-0.5)", -0.54630248984);
-			AssertEvaluatesTo("tan(0.5)", 0.54630248984);
-			AssertEvaluatesTo("tan(-1.3)", -3.60210244797);
-			AssertEvaluatesTo("tan(1.3)", 3.60210244797);
-		}
+        [Test]
+        public virtual void TestTanMethod()
+        {
+            AssertEvaluatesTo("tan(0)", 0);
+            AssertEvaluatesTo("tan(-1)", -1.55740772465);
+            AssertEvaluatesTo("tan(1)", 1.55740772465);
+            AssertEvaluatesTo("tan(-0.5)", -0.54630248984);
+            AssertEvaluatesTo("tan(0.5)", 0.54630248984);
+            AssertEvaluatesTo("tan(-1.3)", -3.60210244797);
+            AssertEvaluatesTo("tan(1.3)", 3.60210244797);
+        }
 
-		[Test]
-		public virtual void TestTanhMethod()
-		{
-			AssertEvaluatesTo("tanh(0)", 0);
-			AssertEvaluatesTo("tanh(-1)", -0.76159415595);
-			AssertEvaluatesTo("tanh(1)", 0.76159415595);
-			AssertEvaluatesTo("tanh(-0.5)", -0.46211715726);
-			AssertEvaluatesTo("tanh(0.5)", 0.46211715726);
-			AssertEvaluatesTo("tanh(-12.3456789)", -0.99999999996);
-			AssertEvaluatesTo("tanh(12.3456789)", 0.99999999996);
-		}
-	}
+        [Test]
+        public virtual void TestTanhMethod()
+        {
+            AssertEvaluatesTo("tanh(0)", 0);
+            AssertEvaluatesTo("tanh(-1)", -0.76159415595);
+            AssertEvaluatesTo("tanh(1)", 0.76159415595);
+            AssertEvaluatesTo("tanh(-0.5)", -0.46211715726);
+            AssertEvaluatesTo("tanh(0.5)", 0.46211715726);
+            AssertEvaluatesTo("tanh(-12.3456789)", -0.99999999996);
+            AssertEvaluatesTo("tanh(12.3456789)", 0.99999999996);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
index 71f8465..0a3b52c 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
@@ -1,10 +1,9 @@
-using Lucene.Net.Expressions;
-using Lucene.Net.Expressions.JS;
+using Lucene.Net.Util;
 using NUnit.Framework;
 
-namespace Lucene.Net.Tests.Expressions.JS
+namespace Lucene.Net.Expressions.JS
 {
-	public class TestJavascriptOperations : Util.LuceneTestCase
+    public class TestJavascriptOperations : LuceneTestCase
 	{
 		
 		private void AssertEvaluatesTo(string expression, long expected)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/Lucene.Net.Tests.Expressions.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/Lucene.Net.Tests.Expressions.csproj b/src/Lucene.Net.Tests.Expressions/Lucene.Net.Tests.Expressions.csproj
index 677289b..8c67c3e 100644
--- a/src/Lucene.Net.Tests.Expressions/Lucene.Net.Tests.Expressions.csproj
+++ b/src/Lucene.Net.Tests.Expressions/Lucene.Net.Tests.Expressions.csproj
@@ -7,7 +7,7 @@
     <ProjectGuid>{F4873D95-4300-4E83-AFFA-EF796495D0F0}</ProjectGuid>
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Lucene.Net.Tests.Expressions</RootNamespace>
+    <RootNamespace>Lucene.Net.Expressions</RootNamespace>
     <AssemblyName>Lucene.Net.Tests.Expressions</AssemblyName>
     <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs b/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
index 1d0c034..d7f1358 100644
--- a/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
@@ -3,7 +3,7 @@ using Lucene.Net.Util;
 using NUnit.Framework;
 using System;
 
-namespace Lucene.Net.Tests.Expressions
+namespace Lucene.Net.Expressions
 {
     /// <summary>
     /// LUCENENET specific tests for ensuring API conventions are followed

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs b/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
index bbe4260..f30f9b4 100644
--- a/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
@@ -1,19 +1,18 @@
-using System;
-using System.Text;
 using Lucene.Net.Documents;
-using Lucene.Net.Expressions;
 using Lucene.Net.Expressions.JS;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Store;
+using Lucene.Net.Util;
 using NUnit.Framework;
-using Expression = System.Linq.Expressions.Expression;
+using System;
+using System.Text;
 
-namespace Lucene.Net.Tests.Expressions
+namespace Lucene.Net.Expressions
 {
     /// <summary>simple demo of using expressions</summary>
     [SuppressCodecs("Lucene3x")]
-    public class TestDemoExpressions : Util.LuceneTestCase
+    public class TestDemoExpressions : LuceneTestCase
 	{
 		internal IndexSearcher searcher;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
index ae8943a..4b37ccb 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
@@ -1,15 +1,15 @@
 using Lucene.Net.Documents;
-using Lucene.Net.Expressions;
 using Lucene.Net.Expressions.JS;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Store;
+using Lucene.Net.Util;
 using NUnit.Framework;
 
-namespace Lucene.Net.Tests.Expressions
+namespace Lucene.Net.Expressions
 {
     [SuppressCodecs("Lucene3x")]
-	public class TestExpressionRescorer : Lucene.Net.Util.LuceneTestCase
+	public class TestExpressionRescorer : LuceneTestCase
 	{
 		internal IndexSearcher searcher;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
index 985e843..23c4608 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
@@ -1,11 +1,11 @@
-using Lucene.Net.Expressions;
 using Lucene.Net.Expressions.JS;
 using Lucene.Net.Search;
+using Lucene.Net.Util;
 using NUnit.Framework;
 
-namespace Lucene.Net.Tests.Expressions
+namespace Lucene.Net.Expressions
 {
-	public class TestExpressionSortField : Util.LuceneTestCase
+    public class TestExpressionSortField : LuceneTestCase
 	{
 		[Test]
 		public virtual void TestToString()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
index 563db40..1610312 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
@@ -1,5 +1,4 @@
 using Lucene.Net.Documents;
-using Lucene.Net.Expressions;
 using Lucene.Net.Expressions.JS;
 using Lucene.Net.Index;
 using Lucene.Net.Randomized.Generators;
@@ -9,7 +8,7 @@ using Lucene.Net.Support;
 using Lucene.Net.Util;
 using NUnit.Framework;
 
-namespace Lucene.Net.Tests.Expressions
+namespace Lucene.Net.Expressions
 {
     /// <summary>
     /// Tests some basic expressions against different queries,
@@ -20,7 +19,7 @@ namespace Lucene.Net.Tests.Expressions
     /// and fieldcache/docvalues fields against an equivalent sort.
     /// </remarks>
     [SuppressCodecs("Lucene3x")]
-    public class TestExpressionSorts : Util.LuceneTestCase
+    public class TestExpressionSorts : LuceneTestCase
     {
         private Directory dir;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
index 9912128..8b117bd 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
@@ -1,13 +1,13 @@
-using System;
-using Lucene.Net.Expressions;
 using Lucene.Net.Expressions.JS;
 using Lucene.Net.Search;
+using Lucene.Net.Util;
 using NUnit.Framework;
+using System;
 
-namespace Lucene.Net.Tests.Expressions
+namespace Lucene.Net.Expressions
 {
-	/// <summary>Tests validation of bindings</summary>
-	public class TestExpressionValidation : Util.LuceneTestCase
+    /// <summary>Tests validation of bindings</summary>
+    public class TestExpressionValidation : LuceneTestCase
 	{
 		[Test]
 		public virtual void TestValidExternals()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/51e3957c/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
index 5ccd24c..3c8b64d 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
@@ -1,18 +1,18 @@
-using System.Collections.Generic;
 using Lucene.Net.Analysis;
 using Lucene.Net.Documents;
-using Lucene.Net.Expressions;
 using Lucene.Net.Expressions.JS;
 using Lucene.Net.Index;
 using Lucene.Net.Queries.Function;
 using Lucene.Net.Search;
 using Lucene.Net.Store;
+using Lucene.Net.Util;
 using NUnit.Framework;
+using System.Collections.Generic;
 
-namespace Lucene.Net.Tests.Expressions
+namespace Lucene.Net.Expressions
 {
     [SuppressCodecs("Lucene3x")]
-	public class TestExpressionValueSource : Util.LuceneTestCase
+	public class TestExpressionValueSource : LuceneTestCase
 	{
 		internal DirectoryReader reader;
 


[09/20] lucenenet git commit: Lucene.Net.Core.Util.PriorityQueue: Added TODO about making the HeapArray into a writable property

Posted by ni...@apache.org.
Lucene.Net.Core.Util.PriorityQueue: Added TODO about making the HeapArray into a writable property


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

Branch: refs/heads/api-work
Commit: 84f26aa25889b3896ada0e357f395cc2bec84f32
Parents: eef1e45
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 04:29:02 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 05:09:54 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/PriorityQueue.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/84f26aa2/src/Lucene.Net.Core/Util/PriorityQueue.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/PriorityQueue.cs b/src/Lucene.Net.Core/Util/PriorityQueue.cs
index 7307ee1..5ad6426 100644
--- a/src/Lucene.Net.Core/Util/PriorityQueue.cs
+++ b/src/Lucene.Net.Core/Util/PriorityQueue.cs
@@ -309,7 +309,7 @@ namespace Lucene.Net.Util
         /// this method returns the internal heap array as T[].
         /// @lucene.internal
         /// </summary>
-        protected T[] GetHeapArray()
+        protected T[] GetHeapArray() // LUCENENET TODO: Change to HeapArray property (writable)
         {
             return heap;
         }


[05/20] lucenenet git commit: BUG: Fixed keynotfound exception in Lucene.Net.Core.Index.SegmentInfo.GetAttribute()

Posted by ni...@apache.org.
BUG: Fixed keynotfound exception in Lucene.Net.Core.Index.SegmentInfo.GetAttribute()


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

Branch: refs/heads/api-work
Commit: e70f4c7b686c80bff8468fd525da3e5e78f2941a
Parents: e20befa
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 01:34:23 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 05:09:23 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/SegmentInfo.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e70f4c7b/src/Lucene.Net.Core/Index/SegmentInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentInfo.cs b/src/Lucene.Net.Core/Index/SegmentInfo.cs
index 00ad1f8..8a72c49 100644
--- a/src/Lucene.Net.Core/Index/SegmentInfo.cs
+++ b/src/Lucene.Net.Core/Index/SegmentInfo.cs
@@ -341,7 +341,9 @@ namespace Lucene.Net.Index
             }
             else
             {
-                return attributes[key];
+                string attribute;
+                attributes.TryGetValue(key, out attribute);
+                return attribute;
             }
         }
 


[16/20] lucenenet git commit: BUG: Fixed culture issue with parsing numbers from string in Lucene.Net.Expressions.JS.JavascriptCompiler

Posted by ni...@apache.org.
BUG: Fixed culture issue with parsing numbers from string in Lucene.Net.Expressions.JS.JavascriptCompiler


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

Branch: refs/heads/api-work
Commit: 3ad36c4d33a366c6fa57f582c65b583229ed157f
Parents: e9ec2ab
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 18:19:30 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 18:19:30 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3ad36c4d/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
index 1f631db..15d0de2 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
@@ -4,6 +4,7 @@ using Lucene.Net.Queries.Function;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -305,19 +306,19 @@ namespace Lucene.Net.Expressions.JS
                         if (bitwiseOps.Any(s => sourceText.Contains(s)))
                         {
                             int val;
-                            if (int.TryParse(text, out val))
+                            if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out val))
                             {
                                 gen.Emit(OpCodes.Ldc_I4, val);
                             }
                             else
                             {
-                                gen.Emit(OpCodes.Ldc_I8,long.Parse(text));
+                                gen.Emit(OpCodes.Ldc_I8,long.Parse(text, CultureInfo.InvariantCulture));
                                 gen.Emit(OpCodes.Conv_Ovf_U4_Un);
                             }
                         }
                         else
                         {
-                            gen.Emit(OpCodes.Ldc_R8, double.Parse(text));
+                            gen.Emit(OpCodes.Ldc_R8, double.Parse(text, CultureInfo.InvariantCulture));
                         }
                         break;
                     }


[13/20] lucenenet git commit: Lucene.Net.TestFramework.Support.CultureInfoSupport: Refactored .NET Core implementation to use a pool of codecs and load only those supported on the platform into a list. Rather than using a Win32 API, this will work cross-

Posted by ni...@apache.org.
Lucene.Net.TestFramework.Support.CultureInfoSupport: Refactored .NET Core implementation to use a pool of codecs and load only those supported on the platform into a list. Rather than using a Win32 API, this will work cross-platform and will still test up to ~500 cultures.


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

Branch: refs/heads/api-work
Commit: bfc94fb318bc7cf3ec8aead7742c8b5007460874
Parents: 5c3392d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 09:00:23 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 09:00:23 2017 +0700

----------------------------------------------------------------------
 .../Support/CultureInfoSupport.cs               | 679 +++++++++++++++++--
 1 file changed, 617 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bfc94fb3/src/Lucene.Net.TestFramework/Support/CultureInfoSupport.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Support/CultureInfoSupport.cs b/src/Lucene.Net.TestFramework/Support/CultureInfoSupport.cs
index 6f80135..586fbfe 100644
--- a/src/Lucene.Net.TestFramework/Support/CultureInfoSupport.cs
+++ b/src/Lucene.Net.TestFramework/Support/CultureInfoSupport.cs
@@ -1,80 +1,635 @@
 \ufeffusing System;
-using System.Collections.Concurrent;
+using System.Collections.Generic;
 using System.Globalization;
-using System.Runtime.InteropServices;
+using System.Linq;
 
 namespace Lucene.Net.Support
 {
     public static class CultureInfoSupport
     {
-        public static CultureInfo[] GetNeutralAndSpecificCultures()
-        {
 #if NETSTANDARD
-            // Because any well-formed culture (xx-XXXX) will succeed in
-            // Windows 10, even if the system does not support the culture,
-            // it did not make sense to enumerate through the cultures.  We
-            // workaround this by pinvoking into Win32 API to get the system
-            // cultures.  When these tests are run on a non-Windows OS, the
-            // Pinvoke will have to import a Linux DLL that supports the
-            // same functionality.
-            // See NativeMethods.EnumSystemLocalesEx for more information.
-            var results = new ConcurrentBag<CultureInfo>();
-
-            Func<string, uint, IntPtr, bool> addLocaleFunc = (localeName, dwFlags, lParam) => {
-                var info = new CultureInfo(localeName);
-                results.Add(info);
-                return true;
-            };
 
-            uint flags = (uint)(NativeMethods.Locale.LOCALE_NEUTRALDATA | NativeMethods.Locale.LOCALE_SPECIFICDATA);
-            var successful = NativeMethods.EnumSystemLocalesEx(
-                new NativeMethods.EnumLocalesProcEx(addLocaleFunc),
-                flags,
-                IntPtr.Zero,
-                IntPtr.Zero);
+        #region culturePool
+        private static string[] specificCulturePool = new string[] 
+        {
+            "fr-KM",
+            "fr-LU",
+            "fr-MA",
+            "fr-MC",
+            "fr-MF",
+            "fr-MG",
+            "fr-ML",
+            "fr-MQ",
+            "fr-MR",
+            "fr-MU",
+            "fr-NC",
+            "fr-NE",
+            "fr-PF",
+            "fr-PM",
+            "fr-RE",
+            "fr-RW",
+            "fr-SC",
+            "fr-SN",
+            "fr-SY",
+            "fr-TD",
+            "fr-TG",
+            "fr-TN",
+            "fr-VU",
+            "fr-WF",
+            "fr-YT",
+            "fur-IT",
+            "fy-NL",
+            "ga-IE",
+            "gd-GB",
+            "gl-ES",
+            "gn-PY",
+            "gsw-CH",
+            "gsw-FR",
+            "gsw-LI",
+            "gu-IN",
+            "guz-KE",
+            "gv-IM",
+            "ha-Latn-GH",
+            "ha-Latn-NE",
+            "ha-Latn-NG",
+            "haw-US",
+            "he-IL",
+            "hi-IN",
+            "hr-BA",
+            "hr-HR",
+            "hsb-DE",
+            "hu-HU",
+            "hy-AM",
+            "ia-001",
+            "ia-FR",
+            "ibb-NG",
+            "id-ID",
+            "ig-NG",
+            "ii-CN",
+            "is-IS",
+            "it-CH",
+            "it-IT",
+            "it-SM",
+            "iu-Cans-CA",
+            "iu-Latn-CA",
+            "ja-JP",
+            "jgo-CM",
+            "jmc-TZ",
+            "jv-Java-ID",
+            "jv-Latn-ID",
+            "ka-GE",
+            "kab-DZ",
+            "kam-KE",
+            "kde-TZ",
+            "kea-CV",
+            "khq-ML",
+            "ki-KE",
+            "kk-KZ",
+            "kkj-CM",
+            "kl-GL",
+            "kln-KE",
+            "km-KH",
+            "kn-IN",
+            "ko-KP",
+            "ko-KR",
+            "kok-IN",
+            "kr-NG",
+            "ks-Arab-IN",
+            "ks-Deva-IN",
+            "ksb-TZ",
+            "ksf-CM",
+            "ksh-DE",
+            "ku-Arab-IQ",
+            "ku-Arab-IR",
+            "kw-GB",
+            "ky-KG",
+            "la-001",
+            "lag-TZ",
+            "lb-LU",
+            "lg-UG",
+            "lkt-US",
+            "ln-AO",
+            "ln-CD",
+            "ln-CF",
+            "ln-CG",
+            "lo-LA",
+            "lrc-IQ",
+            "lrc-IR",
+            "lt-LT",
+            "lu-CD",
+            "luo-KE",
+            "luy-KE",
+            "lv-LV",
+            "mas-KE",
+            "mas-TZ",
+            "mer-KE",
+            "mfe-MU",
+            "mg-MG",
+            "mgh-MZ",
+            "mgo-CM",
+            "mi-NZ",
+            "mk-MK",
+            "ml-IN",
+            "mn-MN",
+            "mn-Mong-CN",
+            "mn-Mong-MN",
+            "mni-IN",
+            "moh-CA",
+            "mr-IN",
+            "ms-BN",
+            "ms-MY",
+            "ms-SG",
+            "mt-MT",
+            "mua-CM",
+            "my-MM",
+            "mzn-IR",
+            "naq-NA",
+            "nb-NO",
+            "nb-SJ",
+            "nd-ZW",
+            "ne-IN",
+            "ne-NP",
+            "nl-AW",
+            "nl-BE",
+            "nl-BQ",
+            "nl-CW",
+            "nl-NL",
+            "nl-SR",
+            "nl-SX",
+            "nmg-CM",
+            "nn-NO",
+            "nnh-CM",
+            "nqo-GN",
+            "nr-ZA",
+            "nso-ZA",
+            "nus-SS",
+            "nyn-UG",
+            "oc-FR",
+            "om-ET",
+            "om-KE",
+            "or-IN",
+            "os-GE",
+            "os-RU",
+            "pa-Arab-PK",
+            "pa-IN",
+            "pap-029",
+            "pl-PL",
+            "prg-001",
+            "prs-AF",
+            "ps-AF",
+            "pt-AO",
+            "pt-BR",
+            "pt-CV",
+            "pt-GW",
+            "pt-MO",
+            "pt-MZ",
+            "pt-PT",
+            "pt-ST",
+            "pt-TL",
+            "quc-Latn-GT",
+            "quz-BO",
+            "quz-EC",
+            "quz-PE",
+            "rm-CH",
+            "rn-BI",
+            "ro-MD",
+            "ro-RO",
+            "rof-TZ",
+            "ru-BY",
+            "ru-KG",
+            "ru-KZ",
+            "ru-MD",
+            "ru-RU",
+            "ru-UA",
+            "rw-RW",
+            "rwk-TZ",
+            "sa-IN",
+            "sah-RU",
+            "saq-KE",
+            "sbp-TZ",
+            "sd-Arab-PK",
+            "sd-Deva-IN",
+            "se-FI",
+            "se-NO",
+            "se-SE",
+            "seh-MZ",
+            "ses-ML",
+            "sg-CF",
+            "shi-Latn-MA",
+            "shi-Tfng-MA",
+            "si-LK",
+            "sk-SK",
+            "sl-SI",
+            "sma-NO",
+            "sma-SE",
+            "smj-NO",
+            "smj-SE",
+            "smn-FI",
+            "sms-FI",
+            "sn-Latn-ZW",
+            "so-DJ",
+            "so-ET",
+            "so-KE",
+            "so-SO",
+            "sq-AL",
+            "sq-MK",
+            "sq-XK",
+            "sr-Cyrl-BA",
+            "sr-Cyrl-ME",
+            "sr-Cyrl-RS",
+            "sr-Cyrl-XK",
+            "sr-Latn-BA",
+            "sr-Latn-ME",
+            "sr-Latn-RS",
+            "sr-Latn-XK",
+            "ss-SZ",
+            "ss-ZA",
+            "ssy-ER",
+            "st-LS",
+            "st-ZA",
+            "sv-AX",
+            "sv-FI",
+            "sv-SE",
+            "sw-CD",
+            "sw-KE",
+            "sw-TZ",
+            "sw-UG",
+            "syr-SY",
+            "ta-IN",
+            "ta-LK",
+            "ta-MY",
+            "ta-SG",
+            "te-IN",
+            "teo-KE",
+            "teo-UG",
+            "tg-Cyrl-TJ",
+            "th-TH",
+            "ti-ER",
+            "ti-ET",
+            "tig-ER",
+            "tk-TM",
+            "tn-BW",
+            "tn-ZA",
+            "to-TO",
+            "tr-CY",
+            "tr-TR",
+            "ts-ZA",
+            "tt-RU",
+            "twq-NE",
+            "tzm-Arab-MA",
+            "tzm-Latn-DZ",
+            "tzm-Latn-MA",
+            "tzm-Tfng-MA",
+            "ug-CN",
+            "uk-UA",
+            "ur-IN",
+            "ur-PK",
+            "uz-Arab-AF",
+            "uz-Cyrl-UZ",
+            "uz-Latn-UZ",
+            "vai-Latn-LR",
+            "vai-Vaii-LR",
+            "ve-ZA",
+            "vi-VN",
+            "vo-001",
+            "vun-TZ",
+            "wae-CH",
+            "wal-ET",
+            "wo-SN",
+            "xh-ZA",
+            "xog-UG",
+            "yav-CM",
+            "yi-001",
+            "yo-BJ",
+            "yo-NG",
+            "zgh-Tfng-MA",
+            "zh-CN",
+            "zh-Hans-HK",
+            "zh-Hans-MO",
+            "zh-HK",
+            "zh-MO",
+            "zh-SG",
+            "zh-TW",
+            "zu-ZA"
+        };
+        private static string[] neutralCulturePool = new string[]
+        {
+            "aa",
+            "af",
+            "agq",
+            "ak",
+            "am",
+            "ar",
+            "arn",
+            "as",
+            "asa",
+            "ast",
+            "az",
+            "az-Cyrl",
+            "az-Latn",
+            "ba",
+            "bas",
+            "be",
+            "bem",
+            "bez",
+            "bg",
+            "bin",
+            "bm",
+            "bm-Latn",
+            "bn",
+            "bo",
+            "br",
+            "brx",
+            "bs",
+            "bs-Cyrl",
+            "bs-Latn",
+            "byn",
+            "ca",
+            "ce",
+            "cgg",
+            "chr",
+            "chr-Cher",
+            "co",
+            "cs",
+            "cu",
+            "cy",
+            "da",
+            "dav",
+            "de",
+            "dje",
+            "dsb",
+            "dua",
+            "dv",
+            "dyo",
+            "dz",
+            "ebu",
+            "ee",
+            "el",
+            "en",
+            "eo",
+            "es",
+            "et",
+            "eu",
+            "ewo",
+            "fa",
+            "ff",
+            "ff-Latn",
+            "fi",
+            "fil",
+            "fo",
+            "fr",
+            "fur",
+            "fy",
+            "ga",
+            "gd",
+            "gl",
+            "gn",
+            "gsw",
+            "gu",
+            "guz",
+            "gv",
+            "ha",
+            "ha-Latn",
+            "haw",
+            "he",
+            "hi",
+            "hr",
+            "hsb",
+            "hu",
+            "hy",
+            "ia",
+            "ibb",
+            "id",
+            "ig",
+            "ii",
+            "is",
+            "it",
+            "iu",
+            "iu-Cans",
+            "iu-Latn",
+            "ja",
+            "jgo",
+            "jmc",
+            "jv",
+            "jv-Java",
+            "jv-Latn",
+            "ka",
+            "kab",
+            "kam",
+            "kde",
+            "kea",
+            "khq",
+            "ki",
+            "kk",
+            "kkj",
+            "kl",
+            "kln",
+            "km",
+            "kn",
+            "ko",
+            "kok",
+            "kr",
+            "ks",
+            "ks-Arab",
+            "ks-Deva",
+            "ksb",
+            "ksf",
+            "ksh",
+            "ku",
+            "ku-Arab",
+            "kw",
+            "ky",
+            "la",
+            "lag",
+            "lb",
+            "lg",
+            "lkt",
+            "ln",
+            "lo",
+            "lrc",
+            "lt",
+            "lu",
+            "luo",
+            "luy",
+            "lv",
+            "mas",
+            "mer",
+            "mfe",
+            "mg",
+            "mgh",
+            "mgo",
+            "mi",
+            "mk",
+            "ml",
+            "mn",
+            "mn-Cyrl",
+            "mn-Mong",
+            "mni",
+            "moh",
+            "mr",
+            "ms",
+            "mt",
+            "mua",
+            "my",
+            "mzn",
+            "naq",
+            "nb",
+            "nd",
+            "ne",
+            "nl",
+            "nmg",
+            "nn",
+            "nnh",
+            "no",
+            "nqo",
+            "nr",
+            "nso",
+            "nus",
+            "nyn",
+            "oc",
+            "om",
+            "or",
+            "os",
+            "pa",
+            "pa-Arab",
+            "pap",
+            "pl",
+            "prg",
+            "prs",
+            "ps",
+            "pt",
+            "quc",
+            "quc-Latn",
+            "quz",
+            "rm",
+            "rn",
+            "ro",
+            "rof",
+            "ru",
+            "rw",
+            "rwk",
+            "sa",
+            "sah",
+            "saq",
+            "sbp",
+            "sd",
+            "sd-Arab",
+            "sd-Deva",
+            "se",
+            "seh",
+            "ses",
+            "sg",
+            "shi",
+            "shi-Latn",
+            "shi-Tfng",
+            "si",
+            "sk",
+            "sl",
+            "sma",
+            "smj",
+            "smn",
+            "sms",
+            "sn",
+            "sn-Latn",
+            "so",
+            "sq",
+            "sr",
+            "sr-Cyrl",
+            "sr-Latn",
+            "ss",
+            "ssy",
+            "st",
+            "sv",
+            "sw",
+            "syr",
+            "ta",
+            "te",
+            "teo",
+            "tg",
+            "tg-Cyrl",
+            "th",
+            "ti",
+            "tig",
+            "tk",
+            "tn",
+            "to",
+            "tr",
+            "ts",
+            "tt",
+            "twq",
+            "tzm",
+            "tzm-Arab",
+            "tzm-Latn",
+            "tzm-Tfng",
+            "ug",
+            "uk",
+            "ur",
+            "uz",
+            "uz-Arab",
+            "uz-Cyrl",
+            "uz-Latn",
+            "vai",
+            "vai-Latn",
+            "vai-Vaii",
+            "ve",
+            "vi",
+            "vo",
+            "vun",
+            "wae",
+            "wal",
+            "wo",
+            "xh",
+            "xog",
+            "yav",
+            "yi",
+            "yo",
+            "zgh",
+            "zgh-Tfng",
+            "zh",
+            "zh-Hans",
+            "zh-Hant",
+            "zu",
+            "zh-CHS",
+            "zh-CHT"
+        };
+        #endregion culturePool
+        private static CultureInfo[] supportedSpecificCultures;
+        private static CultureInfo[] supportedNeutralCultures;
 
-            var cultures = successful ? results.ToArray() : new CultureInfo[0];
-#else
-            var cultures =
-                CultureInfo.GetCultures(CultureTypes.SpecificCultures | CultureTypes.NeutralCultures);
-#endif
-            return cultures;
+        static CultureInfoSupport()
+        {
+            supportedSpecificCultures = LoadSupportedCultures(specificCulturePool);
+            supportedNeutralCultures = LoadSupportedCultures(neutralCulturePool);
         }
-    }
 
-    static class NativeMethods
-    {
-        /// <summary>
-        /// Because of this issue: https://github.com/dotnet/corefx/issues/1669,
-        /// it does not make sense to enumerate through the cultures.  We work
-        /// around this by calling into Win32 API, EnumSystemLocalesEx to fetch
-        /// the OS's cultures.
-        /// This https://msdn.microsoft.com/en-us/library/windows/desktop/dd317829(v=vs.85).aspx
-        /// </summary>
-        [DllImport("Kernel32.dll")]
-        public static extern bool EnumSystemLocalesEx(
-            EnumLocalesProcEx lpLocaleEnumProcEx,
-            uint dwFlags,
-            IntPtr lParam,
-            IntPtr lpReserved
-            );
+        private static CultureInfo[] LoadSupportedCultures(string[] culturePool)
+        {
+            var cultures = new List<CultureInfo>();
 
-        public delegate bool EnumLocalesProcEx(
-            [MarshalAs(UnmanagedType.LPWStr)]
-            string lpLocaleString,
-            uint dwFlags,
-            IntPtr lParam);
+            foreach (var culture in specificCulturePool)
+            {
+                try
+                {
+                    cultures.Add(new CultureInfo(culture));
+                }
+                catch (Exception)
+                {
+                    // ignore
+                }
+            }
 
-        [Flags]
-        public enum Locale
+            return cultures.ToArray();
+        }
+#endif
+
+        public static CultureInfo[] GetNeutralAndSpecificCultures()
         {
-            LOCALE_ALL = 0,                         // enumerate all named based locales
-            LOCALE_WINDOWS = 0x00000001,            // shipped locales and/or replacements for them
-            LOCALE_SUPPLEMENTAL = 0x00000002,       // supplemental locales only
-            LOCALE_ALTERNATE_SORTS = 0x00000004,    // alternate sort locales
-            LOCALE_REPLACEMENT = 0x00000008,        // locales that replace shipped locales (callback flag only)
-            LOCALE_NEUTRALDATA = 0x00000010,        // Locales that are "neutral" (language only, region data is default)
-            LOCALE_SPECIFICDATA = 0x00000020,       // Locales that contain language and region data
+#if NETSTANDARD
+            return supportedNeutralCultures.Union(supportedSpecificCultures).ToArray();
+#else
+            return CultureInfo.GetCultures(CultureTypes.SpecificCultures | CultureTypes.NeutralCultures);
+#endif
+
         }
     }
 }


[06/20] lucenenet git commit: Added FEATURE_COLLATION so it can be left out of the compilation (it doesn't work)

Posted by ni...@apache.org.
Added FEATURE_COLLATION so it can be left out of the compilation (it doesn't work)


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

Branch: refs/heads/api-work
Commit: e20befa0098f5514542486603592a0f057219b0b
Parents: 4e4d17c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 00:03:43 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 05:09:23 2017 +0700

----------------------------------------------------------------------
 .../Collation/CollationAttributeFactory.cs                     | 6 ++++--
 .../Collation/CollationKeyAnalyzer.cs                          | 6 ++++--
 src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilter.cs | 6 ++++--
 .../Collation/CollationKeyFilterFactory.cs                     | 6 ++++--
 .../Collation/TokenAttributes/CollatedTermAttributeImpl.cs     | 6 ++++--
 .../Collation/TestCollationKeyAnalyzer.cs                      | 6 ++++--
 .../Collation/TestCollationKeyFilter.cs                        | 6 ++++--
 .../Collation/TestCollationKeyFilterFactory.cs                 | 6 ++++--
 8 files changed, 32 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Analysis.Common/Collation/CollationAttributeFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Collation/CollationAttributeFactory.cs b/src/Lucene.Net.Analysis.Common/Collation/CollationAttributeFactory.cs
index 6e15ad1..bc2fa88 100644
--- a/src/Lucene.Net.Analysis.Common/Collation/CollationAttributeFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Collation/CollationAttributeFactory.cs
@@ -1,4 +1,5 @@
-\ufeffusing Icu.Collation;
+\ufeff#if FEATURE_COLLATION
+using Icu.Collation;
 using Lucene.Net.Collation.TokenAttributes;
 using Lucene.Net.Util;
 using System.Reflection;
@@ -102,4 +103,5 @@ namespace Lucene.Net.Collation
 				: this.@delegate.CreateAttributeInstance<T>();
 		}
 	}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Analysis.Common/Collation/CollationKeyAnalyzer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Collation/CollationKeyAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Collation/CollationKeyAnalyzer.cs
index 6ebee3d..92ce4a0 100644
--- a/src/Lucene.Net.Analysis.Common/Collation/CollationKeyAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Collation/CollationKeyAnalyzer.cs
@@ -1,4 +1,5 @@
-\ufeffusing Icu.Collation;
+\ufeff#if FEATURE_COLLATION
+using Icu.Collation;
 using Lucene.Net.Analysis;
 using Lucene.Net.Analysis.Core;
 using Lucene.Net.Util;
@@ -126,4 +127,5 @@ namespace Lucene.Net.Collation
             }
         }
 	}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilter.cs b/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilter.cs
index ae90816..4e053d7 100644
--- a/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilter.cs
@@ -1,4 +1,5 @@
-\ufeffusing Icu.Collation;
+\ufeff#if FEATURE_COLLATION
+using Icu.Collation;
 using Lucene.Net.Analysis;
 using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Util;
@@ -122,4 +123,5 @@ namespace Lucene.Net.Collation
 			return unsigned;
 		}
 	}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilterFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilterFactory.cs
index 801692d..0859eda 100644
--- a/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Collation/CollationKeyFilterFactory.cs
@@ -1,4 +1,5 @@
-\ufeffusing Icu;
+\ufeff#if FEATURE_COLLATION
+using Icu;
 using Icu.Collation;
 using Lucene.Net.Analysis;
 using Lucene.Net.Analysis.Util;
@@ -299,4 +300,5 @@ namespace Lucene.Net.Collation
 			return value;
 		}
 	}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Analysis.Common/Collation/TokenAttributes/CollatedTermAttributeImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Collation/TokenAttributes/CollatedTermAttributeImpl.cs b/src/Lucene.Net.Analysis.Common/Collation/TokenAttributes/CollatedTermAttributeImpl.cs
index 05333ed..bb8453d 100644
--- a/src/Lucene.Net.Analysis.Common/Collation/TokenAttributes/CollatedTermAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Common/Collation/TokenAttributes/CollatedTermAttributeImpl.cs
@@ -1,4 +1,5 @@
-\ufeffusing Icu.Collation;
+\ufeff#if FEATURE_COLLATION
+using Icu.Collation;
 using Lucene.Net.Analysis.TokenAttributes;
 using System;
 
@@ -52,4 +53,5 @@ namespace Lucene.Net.Collation.TokenAttributes
 			bytes.Length = bytes.Bytes.Length;
 		}
 	}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
index 6af17e1..5f96c71 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyAnalyzer.cs
@@ -1,4 +1,5 @@
-\ufeffusing Icu;
+\ufeff#if FEATURE_COLLATION
+using Icu;
 using Icu.Collation;
 using Lucene.Net.Analysis;
 using Lucene.Net.Util;
@@ -160,4 +161,5 @@ namespace Lucene.Net.Collation
             return collator;
         }
 	}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilter.cs
index fc6f4c9..c720c4b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilter.cs
@@ -1,4 +1,5 @@
-\ufeffusing System;
+\ufeff#if FEATURE_COLLATION
+using System;
 using System.Globalization;
 using System.IO;
 using System.Linq;
@@ -151,4 +152,5 @@ namespace Lucene.Net.Collation
         //   oStrokeFirst ? "BFJHD" : "BFJDH", "EACGI", "BJDFH", "BJDHF");
         //}
     }
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e20befa0/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilterFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilterFactory.cs b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilterFactory.cs
index 393edd4..4d2042a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilterFactory.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Collation/TestCollationKeyFilterFactory.cs
@@ -1,4 +1,5 @@
-\ufeffusing System.Collections.Generic;
+\ufeff#if FEATURE_COLLATION
+using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using Icu;
@@ -150,4 +151,5 @@ namespace Lucene.Net.Collation
 			stream2.Dispose();
 		}
 	}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file


[14/20] lucenenet git commit: Lucene.Net.TestFramework.Randomized.Generators.RandomInts: Fixed bug in RandomFrom so the entire range is used (the upper bound of Random(int, int) is exclusive, so we don't need to subtract 1 from Count).

Posted by ni...@apache.org.
Lucene.Net.TestFramework.Randomized.Generators.RandomInts: Fixed bug in RandomFrom so the entire range is used (the upper bound of Random(int, int) is exclusive, so we don't need to subtract 1 from Count).


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

Branch: refs/heads/api-work
Commit: 9b9cd8196525f1fae5f8ee6d4c55485e4bfd89aa
Parents: bfc94fb
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 17:14:07 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 17:14:07 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9b9cd819/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs b/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
index edc36d3..f3704a9 100644
--- a/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
+++ b/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
@@ -39,12 +39,12 @@ namespace Lucene.Net.Randomized.Generators
 
         public static T RandomFrom<T>(Random rand, ISet<T> set)
         {
-            return set.ElementAt(rand.Next(0, set.Count - 1));
+            return set.ElementAt(rand.Next(0, set.Count));
         }
 
         public static T RandomFrom<T>(Random rand, IList<T> set)
         {
-            return set.ElementAt(rand.Next(0, set.Count - 1));
+            return set.ElementAt(rand.Next(0, set.Count));
         }
     }
 }
\ No newline at end of file


[15/20] lucenenet git commit: Lucene.Net.TestFramework.Util.TestRuleSetupAndRestoreClassEnv: Added randomization of Culture, TimeZone, and InfoStream.

Posted by ni...@apache.org.
Lucene.Net.TestFramework.Util.TestRuleSetupAndRestoreClassEnv: Added randomization of Culture, TimeZone, and InfoStream.


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

Branch: refs/heads/api-work
Commit: e9ec2abf12feec9fd5608b104f4753ac90f515ab
Parents: 9b9cd81
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 17:17:01 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 17:17:01 2017 +0700

----------------------------------------------------------------------
 .../JavaCompatibility/LuceneTestCase.cs         |  10 -
 .../Util/LuceneTestCase.cs                      |  69 ++--
 .../Util/TestRuleSetupAndRestoreClassEnv.cs     | 344 +++++--------------
 .../Flexible/Standard/TestNumericQueryParser.cs |   4 +-
 4 files changed, 119 insertions(+), 308 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9ec2abf/src/Lucene.Net.TestFramework/JavaCompatibility/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/JavaCompatibility/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/JavaCompatibility/LuceneTestCase.cs
index 913f94b..e417c4f 100644
--- a/src/Lucene.Net.TestFramework/JavaCompatibility/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/JavaCompatibility/LuceneTestCase.cs
@@ -244,15 +244,5 @@ namespace Lucene.Net.Util
                 return v1 * multiplier;
             }
         }
-
-        protected virtual CultureInfo randomLocale(Random random)
-        {
-            return RandomInts.RandomFrom(random, CultureInfoSupport.GetNeutralAndSpecificCultures());
-        }
-
-        protected virtual TimeZoneInfo randomTimeZone(Random random)
-        {
-            return RandomInts.RandomFrom(random, TimeZoneInfo.GetSystemTimeZones());
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9ec2abf/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 812e273..47f8dca 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -1433,46 +1433,45 @@ namespace Lucene.Net.Util
             return new Field(name, value, newType);
         }
 
-        /* LUCENE TODO: removing until use is shown
+        /// <summary>
+        /// Return a random Locale from the available locales on the system. </summary>
+        /// <seealso cref= "https://issues.apache.org/jira/browse/LUCENE-4020" </seealso>
+        public static CultureInfo RandomLocale(Random random)
+        {
+            return RandomInts.RandomFrom(random, CultureInfoSupport.GetNeutralAndSpecificCultures());
+        }
 
-            /// <summary>
-            /// Return a random Locale from the available locales on the system. </summary>
-            /// <seealso cref= "https://issues.apache.org/jira/browse/LUCENE-4020" </seealso>
-            public static CultureInfo RandomLocale(Random random)
-            {
-                CultureInfo[] locales = CultureInfo.GetCultures();
-                return locales[random.Next(locales.Length)];
-            }
-            /// <summary>
-            /// Return a random TimeZone from the available timezones on the system </summary>
-            /// <seealso cref= "https://issues.apache.org/jira/browse/LUCENE-4020"  </seealso>
-            public static TimeZone RandomTimeZone(Random random)
-            {
-                string[] tzIds = TimeZone.AvailableIDs;
-                return TimeZone.getTimeZone(tzIds[random.Next(tzIds.Length)]);
-            }
+        /// <summary>
+        /// Return a random TimeZone from the available timezones on the system </summary>
+        /// <seealso cref= "https://issues.apache.org/jira/browse/LUCENE-4020"  </seealso>
+        public static TimeZoneInfo RandomTimeZone(Random random)
+        {
+            return RandomInts.RandomFrom(random, TimeZoneInfo.GetSystemTimeZones());
+        }
 
-            /// <summary>
-            /// return a Locale object equivalent to its programmatic name </summary>
-            public static Locale LocaleForName(string localeName)
-            {
-                string[] elements = localeName.Split("\\_");
-                switch (elements.Length)
-                {
-                    case 4: // fallthrough for special cases
-                    case 3:
-                    return new Locale(elements[0], elements[1], elements[2]);
+        /// <summary>
+        /// return a Locale object equivalent to its programmatic name </summary>
+        public static CultureInfo LocaleForName(string localeName)
+        {
+            return new CultureInfo(localeName);
 
-                    case 2:
-                    return new Locale(elements[0], elements[1]);
+            //string[] elements = Regex.Split(localeName, "\\_", RegexOptions.Compiled);
+            //switch (elements.Length)
+            //{
+            //    case 4: // fallthrough for special cases
+            //    case 3:
+            //    return new Locale(elements[0], elements[1], elements[2]);
 
-                    case 1:
-                    return new Locale(elements[0]);
+            //    case 2:
+            //    return new Locale(elements[0], elements[1]);
 
-                    default:
-                    throw new System.ArgumentException("Invalid Locale: " + localeName);
-                }
-            }*/
+            //    case 1:
+            //    return new Locale(elements[0]);
+
+            //    default:
+            //    throw new System.ArgumentException("Invalid Locale: " + localeName);
+            //}
+        }
 
         public static bool DefaultCodecSupportsDocValues()
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9ec2abf/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index ba4be2c..9f34248 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -1,46 +1,41 @@
+using Lucene.Net.Codecs.Asserting;
+using Lucene.Net.Codecs.Compressing;
+using Lucene.Net.Codecs.Lucene3x;
+using Lucene.Net.Codecs.Lucene40;
+using Lucene.Net.Codecs.Lucene41;
+using Lucene.Net.Codecs.Lucene42;
+using Lucene.Net.Codecs.Lucene45;
+using Lucene.Net.JavaCompatibility;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Globalization;
 using System.IO;
+using System.Linq;
+using System.Reflection;
 using System.Threading;
 
 namespace Lucene.Net.Util
 {
-    using Codecs;
-    using Codecs.Asserting;
-    using Codecs.CheapBastard;
-    using Codecs.Compressing;
-    using Codecs.Lucene3x;
-    using Codecs.Lucene40;
-    using Codecs.Lucene41;
-    using Codecs.Lucene42;
-    using Codecs.Lucene45;
-    using Codecs.MockRandom;
-    using Codecs.SimpleText;
-    using JavaCompatibility;
-    //using AssumptionViolatedException = org.junit.@internal.AssumptionViolatedException;
-    using Lucene.Net.Randomized.Generators;
-    using Support;
-    using System.Diagnostics;
-    using System.Linq;
-    using System.Reflection;
-
     /*
-         * Licensed to the Apache Software Foundation (ASF) under one or more
-         * contributor license agreements.  See the NOTICE file distributed with
-         * this work for additional information regarding copyright ownership.
-         * The ASF licenses this file to You under the Apache License, Version 2.0
-         * (the "License"); you may not use this file except in compliance with
-         * the License.  You may obtain a copy of the License at
-         *
-         *     http://www.apache.org/licenses/LICENSE-2.0
-         *
-         * Unless required by applicable law or agreed to in writing, software
-         * distributed under the License is distributed on an "AS IS" BASIS,
-         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-         * See the License for the specific language governing permissions and
-         * limitations under the License.
-         */
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
     /*
 	import static Lucene.Net.Util.LuceneTestCase.INFOSTREAM;
 	import static Lucene.Net.Util.LuceneTestCase.TEST_CODEC;
@@ -53,19 +48,17 @@ namespace Lucene.Net.Util
 	import static Lucene.Net.Util.LuceneTestCase.randomLocale;
 	import static Lucene.Net.Util.LuceneTestCase.randomTimeZone;*/
 
+    using CheapBastardCodec = Lucene.Net.Codecs.CheapBastard.CheapBastardCodec;
     using Codec = Lucene.Net.Codecs.Codec;
     using DefaultSimilarity = Lucene.Net.Search.Similarities.DefaultSimilarity;
     using DocValuesFormat = Lucene.Net.Codecs.DocValuesFormat;
-
-    //using CheapBastardCodec = Lucene.Net.Codecs.cheapbastard.CheapBastardCodec;
-    //using MockRandomPostingsFormat = Lucene.Net.Codecs.mockrandom.MockRandomPostingsFormat;
     using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec;
+    using MockRandomPostingsFormat = Lucene.Net.Codecs.MockRandom.MockRandomPostingsFormat;
     using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
-
-    //using SimpleTextCodec = Lucene.Net.Codecs.simpletext.SimpleTextCodec;
     using RandomCodec = Lucene.Net.Index.RandomCodec;
     using RandomSimilarityProvider = Lucene.Net.Search.RandomSimilarityProvider;
     using Similarity = Lucene.Net.Search.Similarities.Similarity;
+    using SimpleTextCodec = Lucene.Net.Codecs.SimpleText.SimpleTextCodec;
 
     //using RandomizedContext = com.carrotsearch.randomizedtesting.RandomizedContext;
 
@@ -81,9 +74,9 @@ namespace Lucene.Net.Util
         private Dictionary<string, string> restoreProperties = new Dictionary<string, string>();
 
         private Codec savedCodec;
-        //private CultureInfo SavedLocale;
-        //private InfoStream SavedInfoStream;
-        //private TimeZoneInfo SavedTimeZone;
+        private CultureInfo savedLocale;
+        private InfoStream savedInfoStream;
+        private TimeZoneInfo savedTimeZone;
 
         internal CultureInfo locale;
         internal TimeZoneInfo timeZone;
@@ -111,18 +104,17 @@ namespace Lucene.Net.Util
                 }
             }
 
-            // LUCENENET TODO: Finish implementation ?
-            //SavedInfoStream = InfoStream.Default;
-            Random random = LuceneTestCase.Random(); //RandomizedContext.Current.Random;
-            //bool v = random.NextBoolean();
-            //if (LuceneTestCase.INFOSTREAM)
-            //{
-            //    InfoStream.Default = new ThreadNameFixingPrintStreamInfoStream(Console.Out);
-            //}
-            //else if (v)
-            //{
-            //    InfoStream.Default = new NullInfoStream();
-            //}
+            savedInfoStream = InfoStream.Default;
+            Random random = LuceneTestCase.Random(); 
+            bool v = random.NextBoolean();
+            if (LuceneTestCase.INFOSTREAM)
+            {
+                InfoStream.Default = new ThreadNameFixingPrintStreamInfoStream(Console.Out);
+            }
+            else if (v)
+            {
+                InfoStream.Default = new NullInfoStream();
+            }
 
             Type targetClass = testInstance.GetType();
             avoidCodecs = new HashSet<string>();
@@ -249,24 +241,29 @@ namespace Lucene.Net.Util
             }
             Codec.Default = codec;
 
-            // LUCENENET TODO: Locale/time zone
-            //// Initialize locale/ timezone.
-            //string testLocale = System.getProperty("tests.locale", "random");
-            //string testTimeZone = System.getProperty("tests.timezone", "random");
-
-            //// Always pick a random one for consistency (whether tests.locale was specified or not).
-            //SavedLocale = Locale.Default;
-            //Locale randomLocale = RandomLocale(random);
-            //Locale = testLocale.Equals("random") ? randomLocale : localeForName(testLocale);
-            //Locale.Default = Locale;
-
-            //// TimeZone.getDefault will set user.timezone to the default timezone of the user's locale.
-            //// So store the original property value and restore it at end.
-            //RestoreProperties["user.timezone"] = System.getProperty("user.timezone");
-            //SavedTimeZone = TimeZone.Default;
-            //TimeZone randomTimeZone = RandomTimeZone(random);
-            //TimeZone = testTimeZone.Equals("random") ? randomTimeZone : TimeZone.getTimeZone(testTimeZone);
-            //TimeZone.Default = TimeZone;
+            // Initialize locale/ timezone.
+            string testLocale = System.Environment.GetEnvironmentVariable("tests.locale") ?? "random";
+            string testTimeZone = System.Environment.GetEnvironmentVariable("tests.timezone") ?? "random";
+
+            // Always pick a random one for consistency (whether tests.locale was specified or not).
+            savedLocale = CultureInfo.CurrentCulture;
+            CultureInfo randomLocale = LuceneTestCase.RandomLocale(random);
+            locale = testLocale.Equals("random") ? randomLocale : LuceneTestCase.LocaleForName(testLocale);
+#if NETSTANDARD
+            CultureInfo.CurrentCulture = locale;
+#else
+            Thread.CurrentThread.CurrentCulture = locale;
+#endif
+
+            // TimeZone.getDefault will set user.timezone to the default timezone of the user's locale.
+            // So store the original property value and restore it at end.
+            restoreProperties["user.timezone"] = System.Environment.GetEnvironmentVariable("user.timezone");
+            savedTimeZone = testInstance.TimeZone;
+            TimeZoneInfo randomTimeZone = LuceneTestCase.RandomTimeZone(random);
+            timeZone = testTimeZone.Equals("random") ? randomTimeZone : TimeZoneInfo.FindSystemTimeZoneById(testTimeZone);
+            //TimeZone.Default = TimeZone; // LUCENENET NOTE: There doesn't seem to be an equivalent to this, but I don't think we need it.
+
+            //TimeZoneInfo.ConvertTime() // LUCENENET TODO: Everywhere TimeZoneInfo is supposed to be used, use this method to convert a dateTime object to the time zone
 
             similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(random);
             
@@ -310,186 +307,6 @@ namespace Lucene.Net.Util
             }
         }
 
-        /*protected internal override void Before()
-        {
-          // enable this by default, for IDE consistency with ant tests (as its the default from ant)
-          // TODO: really should be in solr base classes, but some extend LTC directly.
-          // we do this in beforeClass, because some tests currently disable it
-          RestoreProperties["solr.directoryFactory"] = System.getProperty("solr.directoryFactory");
-          if (System.getProperty("solr.directoryFactory") == null)
-          {
-            System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockDirectoryFactory");
-          }
-
-          // Restore more Solr properties.
-          RestoreProperties["solr.solr.home"] = System.getProperty("solr.solr.home");
-          RestoreProperties["solr.data.dir"] = System.getProperty("solr.data.dir");
-
-          // if verbose: print some debugging stuff about which codecs are loaded.
-          if (LuceneTestCase.VERBOSE)
-          {
-            ISet<string> codecs = Codec.AvailableCodecs();
-            foreach (string codec in codecs)
-            {
-              Console.WriteLine("Loaded codec: '" + codec + "': " + Codec.ForName(codec).GetType().Name);
-            }
-
-            ISet<string> postingsFormats = PostingsFormat.AvailablePostingsFormats();
-            foreach (string postingsFormat in postingsFormats)
-            {
-              Console.WriteLine("Loaded postingsFormat: '" + postingsFormat + "': " + PostingsFormat.ForName(postingsFormat).GetType().Name);
-            }
-          }
-
-          SavedInfoStream = InfoStream.Default;
-          Random random = RandomizedContext.Current.Random;
-          bool v = random.NextBoolean();
-          if (LuceneTestCase.INFOSTREAM)
-          {
-            InfoStream.Default = new ThreadNameFixingPrintStreamInfoStream(Console.Out);
-          }
-          else if (v)
-          {
-            InfoStream.Default = new NullInfoStream();
-          }
-
-          Type targetClass = RandomizedContext.Current.GetTargetType;
-          AvoidCodecs = new HashSet<string>();
-          if (targetClass.isAnnotationPresent(typeof(SuppressCodecs)))
-          {
-            SuppressCodecs a = targetClass.getAnnotation(typeof(SuppressCodecs));
-            AvoidCodecs.AddAll(Arrays.AsList(a.Value()));
-          }
-
-          // set back to default
-          LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
-
-          SavedCodec = Codec.Default;
-          int randomVal = random.Next(10);
-          if ("Lucene3x".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 3 && !ShouldAvoidCodec("Lucene3x"))) // preflex-only setup
-          {
-            Codec = Codec.ForName("Lucene3x");
-            Debug.Assert((Codec is PreFlexRWCodec), "fix your classpath to have tests-framework.jar before lucene-core.jar");
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-          }
-          else if ("Lucene40".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && randomVal == 0 && !ShouldAvoidCodec("Lucene40"))) // 4.0 setup
-          {
-            Codec = Codec.ForName("Lucene40");
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-            Debug.Assert(Codec is Lucene40RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
-            Debug.Assert((PostingsFormat.ForName("Lucene40") is Lucene40RWPostingsFormat), "fix your classpath to have tests-framework.jar before lucene-core.jar");
-          }
-          else if ("Lucene41".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 1 && !ShouldAvoidCodec("Lucene41")))
-          {
-            Codec = Codec.ForName("Lucene41");
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-            Debug.Assert(Codec is Lucene41RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
-          }
-          else if ("Lucene42".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 2 && !ShouldAvoidCodec("Lucene42")))
-          {
-            Codec = Codec.ForName("Lucene42");
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-            Debug.Assert(Codec is Lucene42RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
-          }
-          else if ("Lucene45".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && "random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) && "random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) && randomVal == 5 && !ShouldAvoidCodec("Lucene45")))
-          {
-            Codec = Codec.ForName("Lucene45");
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
-            Debug.Assert(Codec is Lucene45RWCodec, "fix your classpath to have tests-framework.jar before lucene-core.jar");
-          }
-          else if (("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT) == false) || ("random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT) == false))
-          {
-            // the user wired postings or DV: this is messy
-            // refactor into RandomCodec....
-
-            PostingsFormat format;
-            if ("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
-            {
-              format = PostingsFormat.ForName("Lucene41");
-            }
-            else if ("MockRandom".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
-            {
-              format = new MockRandomPostingsFormat(new Random(random.Next()));
-            }
-            else
-            {
-                format = PostingsFormat.ForName(LuceneTestCase.TEST_POSTINGSFORMAT);
-            }
-
-            DocValuesFormat dvFormat;
-            if ("random".Equals(LuceneTestCase.TEST_DOCVALUESFORMAT))
-            {
-              dvFormat = DocValuesFormat.ForName("Lucene45");
-            }
-            else
-            {
-                dvFormat = DocValuesFormat.ForName(LuceneTestCase.TEST_DOCVALUESFORMAT);
-            }
-
-            Codec = new Lucene46CodecAnonymousInnerClassHelper(this, format, dvFormat);
-          }
-          else if ("SimpleText".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 9 && LuceneTestCase.Rarely(random) && !ShouldAvoidCodec("SimpleText")))
-          {
-            Codec = new SimpleTextCodec();
-          }
-          else if ("CheapBastard".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 8 && !ShouldAvoidCodec("CheapBastard") && !ShouldAvoidCodec("Lucene41")))
-          {
-            // we also avoid this codec if Lucene41 is avoided, since thats the postings format it uses.
-            Codec = new CheapBastardCodec();
-          }
-          else if ("Asserting".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 6 && !ShouldAvoidCodec("Asserting")))
-          {
-            Codec = new AssertingCodec();
-          }
-          else if ("Compressing".Equals(LuceneTestCase.TEST_CODEC) || ("random".Equals(LuceneTestCase.TEST_CODEC) && randomVal == 5 && !ShouldAvoidCodec("Compressing")))
-          {
-            Codec = CompressingCodec.RandomInstance(random);
-          }
-          else if (!"random".Equals(LuceneTestCase.TEST_CODEC))
-          {
-              Codec = Codec.ForName(LuceneTestCase.TEST_CODEC);
-          }
-          else if ("random".Equals(LuceneTestCase.TEST_POSTINGSFORMAT))
-          {
-            Codec = new RandomCodec(random, AvoidCodecs);
-          }
-          else
-          {
-            Debug.Assert(false);
-          }
-          Codec.Default = Codec;
-
-          // Initialize locale/ timezone.
-          string testLocale = System.getProperty("tests.locale", "random");
-          string testTimeZone = System.getProperty("tests.timezone", "random");
-
-          // Always pick a random one for consistency (whether tests.locale was specified or not).
-          SavedLocale = Locale.Default;
-          Locale randomLocale = RandomLocale(random);
-          Locale = testLocale.Equals("random") ? randomLocale : localeForName(testLocale);
-          Locale.Default = Locale;
-
-          // TimeZone.getDefault will set user.timezone to the default timezone of the user's locale.
-          // So store the original property value and restore it at end.
-          RestoreProperties["user.timezone"] = System.getProperty("user.timezone");
-          SavedTimeZone = TimeZone.Default;
-          TimeZone randomTimeZone = RandomTimeZone(random);
-          TimeZone = testTimeZone.Equals("random") ? randomTimeZone : TimeZone.getTimeZone(testTimeZone);
-          TimeZone.Default = TimeZone;
-          Similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(new Random());
-
-          // Check codec restrictions once at class level.
-          try
-          {
-            CheckCodecRestrictions(Codec);
-          }
-          catch (Exception e)
-          {
-            Console.Error.WriteLine("NOTE: " + e.Message + " Suppressed codecs: " + Arrays.ToString(AvoidCodecs.ToArray()));
-            throw e;
-          }
-        }*/
-
         private class Lucene46CodecAnonymousInnerClassHelper : Lucene46Codec
         {
             private readonly TestRuleSetupAndRestoreClassEnv outerInstance;
@@ -561,15 +378,20 @@ namespace Lucene.Net.Util
             restoreProperties.Clear();
 
             Codec.Default = savedCodec;
-            //InfoStream.Default = savedInfoStream;
-            //if (savedLocale != null)
-            //{
-            //    locale = savedLocale;
-            //}
-            //if (savedTimeZone != null)
-            //{
-            //    timeZone = savedTimeZone;
-            //}
+            InfoStream.Default = savedInfoStream;
+            if (savedLocale != null)
+            {
+                locale = savedLocale;
+#if NETSTANDARD
+                CultureInfo.CurrentCulture = savedLocale;
+#else
+                Thread.CurrentThread.CurrentCulture = savedLocale;
+#endif
+            }
+            if (savedTimeZone != null)
+            {
+                timeZone = savedTimeZone;
+            }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9ec2abf/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
index 99ba96f..601c1d0 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
@@ -97,8 +97,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 }
 
                 dateFormatSanityCheckPass = true;
-                LOCALE = randomLocale(Random());
-                TIMEZONE = randomTimeZone(Random());
+                LOCALE = RandomLocale(Random());
+                TIMEZONE = RandomTimeZone(Random());
                 DATE_STYLE = randomDateStyle(Random());
                 TIME_STYLE = randomDateStyle(Random());
 


[07/20] lucenenet git commit: Fixed all OneTimeSetUp and OneTimeTearDown methods to be named BeforeClass() and AfterClass() and called base classes to ensure correct calling order

Posted by ni...@apache.org.
Fixed all OneTimeSetUp and OneTimeTearDown methods to be named BeforeClass() and AfterClass() and called base classes to ensure correct calling order


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

Branch: refs/heads/api-work
Commit: 6de19b957fb438755d0559d9cfdec27e06432f52
Parents: e70f4c7
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 02:07:54 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 05:09:25 2017 +0700

----------------------------------------------------------------------
 .../Index/BasePostingsFormatTestCase.cs                      | 7 +++++--
 .../Search/RandomSimilarityProvider.cs                       | 1 -
 .../Search/SearchEquivalenceTestBase.cs                      | 3 ++-
 .../Util/TestRuleSetupAndRestoreClassEnv.cs                  | 2 +-
 .../Analysis/Core/TestRandomChains.cs                        | 4 +++-
 .../Analysis/Hunspell/TestHunspellStemFilter.cs              | 3 ++-
 .../Taxonomy/TestTaxonomyFacetAssociations.cs                | 4 +++-
 .../Taxonomy/TestTaxonomyFacetCounts2.cs                     | 7 +++++--
 src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs             | 8 ++++++--
 src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs       | 7 +++++--
 src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs   | 4 +++-
 src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs     | 8 ++++++--
 .../Index/Sorter/SortingAtomicReaderTest.cs                  | 3 ++-
 src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs          | 8 ++++++--
 .../Flexible/Precedence/TestPrecedenceQueryParser.cs         | 6 ++++--
 .../Flexible/Standard/TestNumericQueryParser.cs              | 4 +++-
 .../Flexible/Standard/TestQPHelper.cs                        | 3 ++-
 src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs | 3 ++-
 src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs           | 4 ++--
 .../Queries/TestSortedSetSortFieldSelectors.cs               | 8 ++++++--
 .../Codecs/Lucene3x/TestTermInfosReaderIndex.cs              | 5 ++++-
 src/Lucene.Net.Tests/Index/Test2BDocs.cs                     | 5 +++--
 src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs     | 7 +++++--
 src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs   | 7 +++++--
 src/Lucene.Net.Tests/Index/TestFieldsReader.cs               | 3 ++-
 src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs   | 3 ++-
 src/Lucene.Net.Tests/Index/TestIndexInput.cs                 | 3 ++-
 src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs           | 7 +++++--
 src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs | 3 ++-
 src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs | 5 ++++-
 src/Lucene.Net.Tests/Search/Spans/TestBasics.cs              | 3 ++-
 .../Search/Spans/TestFieldMaskingSpanQuery.cs                | 3 ++-
 src/Lucene.Net.Tests/Search/TestBoolean2.cs                  | 3 ++-
 src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs     | 3 ++-
 src/Lucene.Net.Tests/Search/TestDateFilter.cs                | 8 ++++++--
 src/Lucene.Net.Tests/Search/TestExplanations.cs              | 7 +++++--
 src/Lucene.Net.Tests/Search/TestFieldCache.cs                | 3 ++-
 src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs           | 3 ++-
 src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs    | 3 ++-
 src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs    | 3 ++-
 src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs          | 3 ++-
 src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs       | 3 ++-
 src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs       | 3 ++-
 src/Lucene.Net.Tests/Search/TestPhraseQuery.cs               | 4 +++-
 src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs      | 4 +++-
 src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs            | 8 ++++++--
 src/Lucene.Net.Tests/Search/TestTermVectors.cs               | 4 +++-
 47 files changed, 150 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
index 397050f..4715fc2 100644
--- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
@@ -368,8 +368,10 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeSetUp]
-        public static void CreatePostings()
+        public override void BeforeClass() // Renamed from CreatePostings to ensure the base class setup is called before this one
         {
+            base.BeforeClass();
+
             TotalPostings = 0;
             TotalPayloadBytes = 0;
             Fields = new SortedDictionary<string, SortedDictionary<BytesRef, long>>();
@@ -486,12 +488,13 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             AllTerms = null;
             FieldInfos = null;
             Fields = null;
             GlobalLiveDocs = null;
+            base.AfterClass();
         }
 
         // TODO maybe instead of @BeforeClass just make a single test run: build postings & index & test it?

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs b/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
index fb80307..a616bf1 100644
--- a/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
+++ b/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
@@ -74,7 +74,6 @@ namespace Lucene.Net.Search
             ShouldQueryNorm = random.NextBoolean();
             KnownSims = new List<Similarity>(AllSims);
             Collections.Shuffle(KnownSims, random);
-            //Collections.shuffle(KnownSims, random);
         }
 
         public override float Coord(int overlap, int maxOverlap)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs b/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
index 312203b..5b8dec1 100644
--- a/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
+++ b/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
@@ -109,7 +109,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Directory.Dispose();
@@ -118,6 +118,7 @@ namespace Lucene.Net.Search
             Directory = null;
             Analyzer = null;
             S1 = S2 = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index ce0ddfa..bef99b6 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -268,7 +268,7 @@ namespace Lucene.Net.Util
             //TimeZone = testTimeZone.Equals("random") ? randomTimeZone : TimeZone.getTimeZone(testTimeZone);
             //TimeZone.Default = TimeZone;
 
-            similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(new Random(1));
+            similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(random);
             
             // Check codec restrictions once at class level.
             try

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
index 2f7ccb3..2607c19 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
@@ -260,11 +260,13 @@ namespace Lucene.Net.Analysis.Core
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             tokenizers = null;
             tokenfilters = null;
             charfilters = null;
+
+            base.AfterClass();
         }
 
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
index 799544d..8873b7a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
@@ -46,9 +46,10 @@ namespace Lucene.Net.Analysis.Hunspell
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             dictionary = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
index d67e1f5..6f3b1e5 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
@@ -95,7 +95,7 @@ namespace Lucene.Net.Facet.Taxonomy
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             reader.Dispose();
             reader = null;
@@ -105,6 +105,8 @@ namespace Lucene.Net.Facet.Taxonomy
             taxoReader = null;
             taxoDir.Dispose();
             taxoDir = null;
+
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
index ab94a16..ef1f02c 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
@@ -86,9 +86,10 @@ namespace Lucene.Net.Facet.Taxonomy
         private static IDictionary<string, int?> allExpectedCounts, termExpectedCounts;
 
         [OneTimeTearDown]
-        public static void AfterClassCountingFacetsAggregatorTest()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassCountingFacetsAggregatorTest() to ensure calling order
         {
             IOUtils.Close(indexDir, taxoDir);
+            base.AfterClass();
         }
 
         private static IList<FacetField> RandomCategories(Random random)
@@ -246,8 +247,10 @@ namespace Lucene.Net.Facet.Taxonomy
         }
 
         [OneTimeSetUp]
-        public void BeforeClassCountingFacetsAggregatorTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassCountingFacetsAggregatorTest() to ensure calling order
         {
+            base.BeforeClass();
+
             indexDir = NewDirectory();
             taxoDir = NewDirectory();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs b/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
index 2ab70d8..4227f8c 100644
--- a/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
+++ b/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Facet
 
       
         [OneTimeTearDown]
-        public static void AfterClassDrillDownQueryTest()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassDrillDownQueryTest() to ensure calling order
         {
             IOUtils.Close(reader, taxo, dir, taxoDir);
             reader = null;
@@ -65,11 +65,15 @@ namespace Lucene.Net.Facet
             dir = null;
             taxoDir = null;
             config = null;
+
+            base.AfterClass();
         }
 
         [OneTimeSetUp]
-        public void BeforeClassDrillDownQueryTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassDrillDownQueryTest() to ensure calling order
         {
+            base.BeforeClass();
+
             dir = NewDirectory();
             Random r = Random();
             RandomIndexWriter writer = new RandomIndexWriter(r, dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(r, MockTokenizer.KEYWORD, false)));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
index 228cb8b..cacef9e 100644
--- a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
+++ b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
@@ -21,7 +21,7 @@ namespace Lucene.Net.Documents
         public Directory dir = NewDirectory();
 
         [OneTimeTearDown]
-        public void RemoveIndex()
+        public override void AfterClass() // LUCENENET specific - changed from CreateIndex() to ensure calling order vs base class
         {
             if (null != dir)
             {
@@ -32,11 +32,14 @@ namespace Lucene.Net.Documents
                 }
                 catch (Exception /*e*/) { /* NOOP */ }
             }
+
+            base.AfterClass();
         }
 
         [OneTimeSetUp]
-        public void CreateIndex()
+        public override void BeforeClass() // LUCENENET specific - changed from CreateIndex() to ensure calling order vs base class
         {
+            base.BeforeClass();
 
             Analyzer analyzer = new MockAnalyzer(Random());
             IndexWriter writer = new IndexWriter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
index 455d9ef..2baad9a 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
@@ -34,8 +34,10 @@ namespace Lucene.Net.Index.Sorter
         };
 
         [OneTimeSetUp]
-        public void BeforeClassSorterUtilTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassSorterUtilTest() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             // only read the values of the undeleted documents, since after addIndexes,
             // the deleted ones will be dropped from the index.
             IBits liveDocs = reader.LiveDocs;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
index 9e2ad28..b78f64f 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
@@ -214,8 +214,10 @@ namespace Lucene.Net.Index.Sorter
         }
 
         [OneTimeSetUp]
-        public void BeforeClassSorterTestBase()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassSorterTestBase() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             dir = NewDirectory();
             int numDocs = AtLeast(20);
             CreateIndex(dir, numDocs, Random());
@@ -224,10 +226,12 @@ namespace Lucene.Net.Index.Sorter
         }
 
         [OneTimeTearDown]
-        public static void AfterClassSorterTestBase()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassSorterTestBase() to ensure calling order vs base class
         {
             reader.Dispose();
             dir.Dispose();
+
+            base.AfterClass();
         }
 
         // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
index b296091..191830b 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
@@ -26,8 +26,9 @@ namespace Lucene.Net.Index.Sorter
     public class SortingAtomicReaderTest : SorterTestBase
     {
         [OneTimeSetUp]
-        public static void BeforeClassSortingAtomicReaderTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassSortingAtomicReaderTest() to ensure calling order vs base class
         {
+            base.BeforeClass();
 
             // sort the index by id (as integer, in NUMERIC_DV_FIELD)
             Sort sort = new Sort(new SortField(NUMERIC_DV_FIELD, SortFieldType.INT32));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
index 5b27e86..dadac2a 100644
--- a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
+++ b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
@@ -16,8 +16,10 @@ namespace Lucene.Net.Misc
         private static IndexReader reader = null;
 
         [OneTimeSetUp]
-        public void SetUpClass()
+        public override void BeforeClass() // LUCENENET specific - renamed from SetUpClass() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             dir = NewDirectory();
             writer = new IndexWriter(dir, NewIndexWriterConfig(Random(),
                TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false))
@@ -28,13 +30,15 @@ namespace Lucene.Net.Misc
         }
 
         [OneTimeTearDown]
-        public static void TearDownClass()
+        public override void AfterClass() // LUCENENET specific - renamed from TearDownClass() to ensure calling order vs base class
         {
             reader.Dispose();
             dir.Dispose();
             dir = null;
             reader = null;
             writer = null;
+
+            base.AfterClass();
         }
         /******************** Tests for getHighFreqTerms **********************************/
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
index 4f82620..fe62cda 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
@@ -47,15 +47,17 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
         public static Analyzer qpAnalyzer;
 
         [OneTimeSetUp]
-        public static void beforeClass()
+        public override void BeforeClass()
         {
+            base.BeforeClass();
             qpAnalyzer = new QPTestAnalyzer();
         }
 
         [OneTimeTearDown]
-        public static void afterClass()
+        public override void AfterClass()
         {
             qpAnalyzer = null;
+            base.AfterClass();
         }
 
         public sealed class QPTestFilter : TokenFilter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
index 179cf27..99ba96f 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
@@ -570,7 +570,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             searcher = null;
             reader.Dispose();
@@ -578,6 +578,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             directory.Dispose();
             directory = null;
             qp = null;
+
+            base.AfterClass();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
index e157111..5c4fa18 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
@@ -57,9 +57,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             qpAnalyzer = null;
+            base.AfterClass();
         }
 
         public sealed class QPTestFilter : TokenFilter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
index f4471ab..ffffc76 100644
--- a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
@@ -33,9 +33,10 @@ namespace Lucene.Net.QueryParsers.Util
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             qpAnalyzer = null;
+            base.AfterClass();
         }
 
         public sealed class QPTestFilter : TokenFilter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
index f8de85a..6aae1a4 100644
--- a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
@@ -70,11 +70,10 @@ namespace Lucene.Net.QueryParsers.Xml
             writer.Dispose();
             reader = DirectoryReader.Open(dir);
             searcher = NewSearcher(reader);
-
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             reader.Dispose();
             dir.Dispose();
@@ -82,6 +81,7 @@ namespace Lucene.Net.QueryParsers.Xml
             searcher = null;
             dir = null;
             builder = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs b/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
index 6187dcc..76a0ef5 100644
--- a/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
+++ b/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
@@ -37,8 +37,10 @@ namespace Lucene.Net.Sandbox.Queries
         static Codec savedCodec;
 
         [OneTimeSetUp]
-        public static void beforeClass()
+        public override void BeforeClass()
         {
+            base.BeforeClass();
+
             savedCodec = Codec.Default;
             // currently only these codecs that support random access ordinals
             int victim = Random().nextInt(3);
@@ -51,9 +53,11 @@ namespace Lucene.Net.Sandbox.Queries
         }
 
         [OneTimeTearDown]
-        public static void afterClass()
+        public override void AfterClass()
         {
             Codec.Default = (savedCodec);
+
+            base.AfterClass();
         }
 
         public override void SetUp()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
index 246a3ec..d522254 100644
--- a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
+++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
@@ -70,6 +70,8 @@ namespace Lucene.Net.Codecs.Lucene3x
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             // NOTE: turn off compound file, this test will open some index files directly.
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
             IndexWriterConfig config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.KEYWORD, false)).SetUseCompoundFile(false);
@@ -112,7 +114,7 @@ namespace Lucene.Net.Codecs.Lucene3x
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             TermEnum.Dispose();
             Reader.Dispose();
@@ -122,6 +124,7 @@ namespace Lucene.Net.Codecs.Lucene3x
             Directory = null;
             Index = null;
             SampleTerms = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/Test2BDocs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/Test2BDocs.cs b/src/Lucene.Net.Tests/Index/Test2BDocs.cs
index 2c8c5a9..f7ce0f7 100644
--- a/src/Lucene.Net.Tests/Index/Test2BDocs.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BDocs.cs
@@ -46,14 +46,15 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             Dir.Dispose();
             Dir = null;
             base.TearDown();
+            base.AfterClass();
         }
 
-        public override void TearDown()
+        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
         {
             // LUCENENET: We don't want our temp directory deleted until after
             // all of the tests in the class run. So we need to override this and

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
index 163bbc7..c815c91 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
@@ -202,6 +202,8 @@ namespace Lucene.Net.Index
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             Assert.IsFalse(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "test infra is broken!");
             IList<string> names = new List<string>(OldNames.Length + OldSingleSegmentNames.Length);
             names.AddRange(Arrays.AsList(OldNames));
@@ -219,7 +221,7 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             foreach (Directory d in OldIndexDirs.Values)
             {
@@ -227,9 +229,10 @@ namespace Lucene.Net.Index
             }
             OldIndexDirs = null;
             base.TearDown();
+            base.AfterClass();
         }
 
-        public override void TearDown()
+        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
         {
             // LUCENENET: We don't want our temp directory deleted until after
             // all of the tests in the class run. So we need to override this and

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
index 19a2e98..8b437ac 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
@@ -131,6 +131,8 @@ namespace Lucene.Net.Index
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             assertFalse("test infra is broken!", OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             IList<string> names = new List<string>(OldNames.Length + OldSingleSegmentNames.Length);
             names.AddRange(Arrays.AsList(OldNames));
@@ -148,7 +150,7 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             foreach (Directory d in OldIndexDirs.Values)
             {
@@ -156,9 +158,10 @@ namespace Lucene.Net.Index
             }
             OldIndexDirs = null;
             base.TearDown();
+            base.AfterClass();
         }
 
-        public override void TearDown()
+        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
         {
             // LUCENENET: We don't want our temp directory deleted until after
             // all of the tests in the class run. So we need to override this and

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestFieldsReader.cs b/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
index 698eacd..86ef767 100644
--- a/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
@@ -70,12 +70,13 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Dir.Dispose();
             Dir = null;
             FieldInfos = null;
             TestDoc = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
index c9bf2e1..9aa5936 100644
--- a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
@@ -47,10 +47,11 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             LineDocFile.Dispose();
             LineDocFile = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexInput.cs b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
index 82e293a..a0ded79 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexInput.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
@@ -74,11 +74,12 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             INTS = null;
             LONGS = null;
             RANDOM_TEST_BYTES = null;
+            base.AfterClass();
         }
 
         private void CheckReads(DataInput @is, Type expectedEx)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs b/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
index 3bd412e..0d907e7 100644
--- a/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
+++ b/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
@@ -101,8 +101,10 @@ namespace Lucene.Net.Search
         /// longer static.
         /// </summary>
         [OneTimeSetUp]
-        public void BeforeClassBaseTestRangeFilter()
+        public override void BeforeClass() // LUCENENET specific: renamed from BeforeClassBaseTestRangeFilter() so we can override to control the order of execution
         {
+            base.BeforeClass();
+
             MaxId = AtLeast(500);
             SignedIndexDir = new TestIndex(Random(), int.MaxValue, int.MinValue, true);
             UnsignedIndexDir = new TestIndex(Random(), int.MaxValue, 0, false);
@@ -111,7 +113,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClassBaseTestRangeFilter()
+        public override void AfterClass() // LUCENENET specific: renamed from AfterClassBaseTestRangeFilter() so we can override to control the order of execution
         {
             SignedIndexReader.Dispose();
             UnsignedIndexReader.Dispose();
@@ -121,6 +123,7 @@ namespace Lucene.Net.Search
             UnsignedIndexReader = null;
             SignedIndexDir = null;
             UnsignedIndexDir = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
index c21fbb8..fe840dc 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
@@ -138,13 +138,14 @@ namespace Lucene.Net.Search.Payloads
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
index 44f70c3..3260d41 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
@@ -122,6 +122,8 @@ namespace Lucene.Net.Search.Payloads
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             Directory = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()).SetSimilarity(similarity).SetMergePolicy(NewLogMergePolicy()));
             //writer.infoStream = System.out;
@@ -143,13 +145,14 @@ namespace Lucene.Net.Search.Payloads
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs b/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
index de0dfb8..111b332 100644
--- a/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
+++ b/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
@@ -134,7 +134,7 @@ namespace Lucene.Net.Search.Spans
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Directory.Dispose();
@@ -142,6 +142,7 @@ namespace Lucene.Net.Search.Spans
             Reader = null;
             Directory = null;
             SimplePayloadAnalyzer = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs b/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
index a4c144a..3ffc936 100644
--- a/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
@@ -81,13 +81,14 @@ namespace Lucene.Net.Search.Spans
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         protected internal virtual void Check(SpanQuery q, int[] docs)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestBoolean2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestBoolean2.cs b/src/Lucene.Net.Tests/Search/TestBoolean2.cs
index 093b0d1..7c9b66d 100644
--- a/src/Lucene.Net.Tests/Search/TestBoolean2.cs
+++ b/src/Lucene.Net.Tests/Search/TestBoolean2.cs
@@ -123,7 +123,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             LittleReader.Dispose();
@@ -135,6 +135,7 @@ namespace Lucene.Net.Search
             Dir2 = null;
             Directory = null;
             BigSearcher = null;
+            base.AfterClass();
         }
 
         private static string[] DocFields = new string[] { "w1 w2 w3 w4 w5", "w1 w3 w2 w3", "w1 xx w2 yy w3", "w1 w3 xx w2 yy w3" };

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
index 3fe841a..83cfb16 100644
--- a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
+++ b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
@@ -77,13 +77,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             s = null;
             r.Dispose();
             r = null;
             Index.Dispose();
             Index = null;
+            base.AfterClass();
         }
 
         public virtual void VerifyNrHits(Query q, int expected)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestDateFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestDateFilter.cs b/src/Lucene.Net.Tests/Search/TestDateFilter.cs
index 11e62e1..4bdb093 100644
--- a/src/Lucene.Net.Tests/Search/TestDateFilter.cs
+++ b/src/Lucene.Net.Tests/Search/TestDateFilter.cs
@@ -42,8 +42,10 @@ namespace Lucene.Net.Search
     {
         ///
         [OneTimeSetUp]
-        public virtual void TestBefore()
+        public override void BeforeClass() // LUCENENET specific - renamed from TestBefore() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             // create an index
             Directory indexStore = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), indexStore, Similarity, TimeZone);
@@ -106,7 +108,7 @@ namespace Lucene.Net.Search
 
         ///
         [OneTimeTearDown]
-        public virtual void TestAfter()
+        public override void AfterClass() // LUCENENET specific - renamed from TestAfter() to ensure calling order vs base class
         {
             // create an index
             Directory indexStore = NewDirectory();
@@ -160,6 +162,8 @@ namespace Lucene.Net.Search
             Assert.AreEqual(0, result.Length);
             reader.Dispose();
             indexStore.Dispose();
+
+            base.AfterClass();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestExplanations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestExplanations.cs b/src/Lucene.Net.Tests/Search/TestExplanations.cs
index ee2abb2..f4a219b 100644
--- a/src/Lucene.Net.Tests/Search/TestExplanations.cs
+++ b/src/Lucene.Net.Tests/Search/TestExplanations.cs
@@ -64,13 +64,14 @@ namespace Lucene.Net.Search
         public const string ALTFIELD = "alt";
 
         [OneTimeTearDown]
-        public static void AfterClassTestExplanations()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassTestExplanations() to ensure calling order
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         /// <summary>
@@ -79,8 +80,10 @@ namespace Lucene.Net.Search
         /// NewStringField are no longer static.
         /// </summary>
         [OneTimeSetUp]
-        public void BeforeClassTestExplanations()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassTestExplanations() to ensure calling order
         {
+            base.BeforeClass();
+
             Directory = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergePolicy(NewLogMergePolicy()));
             for (int i = 0; i < DocFields.Length; i++)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestFieldCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
index 41bfdee..8e35474 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
@@ -168,7 +168,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Reader = null;
@@ -176,6 +176,7 @@ namespace Lucene.Net.Search
             Directory = null;
             UnicodeStrings = null;
             MultiValued = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs b/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
index 4103f91..ecc332e 100644
--- a/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
+++ b/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             atomicReader.Dispose();
             Dir.Dispose();
@@ -122,6 +122,7 @@ namespace Lucene.Net.Search
             atomicReader = null;
             r = null;
             Dir = null;
+            base.AfterClass();
         }
 
         private static void AddSome(Document doc, string[] values)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
index ef754e4..1260ca5 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
@@ -83,12 +83,13 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Small.Dispose();
             Reader = null;
             Small = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
index 88abfb6..ec907df 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
@@ -88,7 +88,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             MultiReader.Dispose();
@@ -99,6 +99,7 @@ namespace Lucene.Net.Search
             Reader = MultiReader = MultiReaderDupls = null;
             Searcher = MultiSearcher = MultiSearcherDupls = null;
             Dir = Sdir1 = Sdir2 = null;
+            base.AfterClass();
         }
 
         private Query ExtractInnerQuery(Query q)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs b/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
index bbcb21f..3693a6c 100644
--- a/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
@@ -48,12 +48,13 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
index 10ba1fc..d82564c 100644
--- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
+++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
@@ -137,13 +137,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [SetUp]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
index bb89508..ffa2557 100644
--- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
+++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
@@ -146,13 +146,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [SetUp]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs b/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
index 05042d0..fb5fc39 100644
--- a/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
@@ -111,13 +111,15 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs b/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
index de130ae..f426a2a 100644
--- a/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
@@ -85,13 +85,15 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs b/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
index 1be58e1..f92118a 100644
--- a/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
+++ b/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
@@ -37,8 +37,10 @@ namespace Lucene.Net.Search
         private static IndexSearcher s;
 
         [OneTimeSetUp]
-        public void MakeIndex()
+        public override void BeforeClass() // LUCENENET specific - renamed from MakeIndex() to ensure calling order
         {
+            base.BeforeClass();
+
             Dir = new RAMDirectory();
             RandomIndexWriter w = new RandomIndexWriter(Random(), Dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergePolicy(NewLogMergePolicy()));
             // make sure we have more than one segment occationally
@@ -59,12 +61,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void Finish()
+        public override void AfterClass() // LUCENENET specific - renamed from Finish() to ensure calling order
         {
             s.IndexReader.Dispose();
             s = null;
             Dir.Dispose();
             Dir = null;
+
+            base.AfterClass();
         }
 
         private class CountingCollector : ICollector

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestTermVectors.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestTermVectors.cs b/src/Lucene.Net.Tests/Search/TestTermVectors.cs
index 58aad23..490115f 100644
--- a/src/Lucene.Net.Tests/Search/TestTermVectors.cs
+++ b/src/Lucene.Net.Tests/Search/TestTermVectors.cs
@@ -96,12 +96,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Directory.Dispose();
             Reader = null;
             Directory = null;
+
+            base.AfterClass();
         }
 
         // In a single doc, for the same field, mix the term


[08/20] lucenenet git commit: Lucene.Net.Tests.Search.TestTopDocsMerge: Explicitly failed TestSort_1 and TestSort_2 for now because of a deadlock somewhere that causes NUnit to crash.

Posted by ni...@apache.org.
Lucene.Net.Tests.Search.TestTopDocsMerge: Explicitly failed TestSort_1 and TestSort_2 for now because of a deadlock somewhere that causes NUnit to crash.


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

Branch: refs/heads/api-work
Commit: eef1e45b86df0e84728ab3780de1f88d334d83de
Parents: 6de19b9
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 04:28:08 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 05:09:53 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/eef1e45b/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs b/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs
index a3391de..8551352 100644
--- a/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs
+++ b/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs
@@ -73,12 +73,14 @@ namespace Lucene.Net.Search
         [Test]
         public virtual void TestSort_1()
         {
+            fail("This test deadlocks when other tests in Lucene.Net.Tests are run at the same time (need to investigate which ones and why)");
             TestSort(false);
         }
 
         [Test]
         public virtual void TestSort_2()
         {
+            fail("This test deadlocks when other tests in Lucene.Net.Tests are run at the same time (need to investigate which ones and why)");
             TestSort(true);
         }
 


[18/20] lucenenet git commit: Lucene.Net.Tests.Expressions: Added license headers

Posted by ni...@apache.org.
Lucene.Net.Tests.Expressions: Added license headers


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

Branch: refs/heads/api-work
Commit: 1d1ff89977097c9bd4dad0b5a274c36aa4a04c90
Parents: 51e3957
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Feb 28 18:26:20 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Feb 28 18:26:20 2017 +0700

----------------------------------------------------------------------
 .../JS/TestCustomFunctions.cs                      | 17 +++++++++++++++++
 .../JS/TestJavascriptCompiler.cs                   | 17 +++++++++++++++++
 .../JS/TestJavascriptFunction.cs                   | 17 +++++++++++++++++
 .../JS/TestJavascriptOperations.cs                 | 17 +++++++++++++++++
 .../TestApiConsistency.cs                          | 17 +++++++++++++++++
 .../TestDemoExpressions.cs                         | 17 +++++++++++++++++
 .../TestExpressionRescorer.cs                      | 17 +++++++++++++++++
 .../TestExpressionSortField.cs                     | 17 +++++++++++++++++
 .../TestExpressionSorts.cs                         | 17 +++++++++++++++++
 .../TestExpressionValidation.cs                    | 17 +++++++++++++++++
 .../TestExpressionValueSource.cs                   | 17 +++++++++++++++++
 11 files changed, 187 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
index 8d98e35..f9c0435 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs
@@ -8,6 +8,23 @@ using System.Reflection;
 
 namespace Lucene.Net.Expressions.JS
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     [TestFixture]
 	public class TestCustomFunctions : LuceneTestCase
 	{

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
index 730e057..945eb8c 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptCompiler.cs
@@ -4,6 +4,23 @@ using System;
 
 namespace Lucene.Net.Expressions.JS
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     public class TestJavascriptCompiler : LuceneTestCase
 	{
 		[Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
index 66f6bab..d15995c 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptFunction.cs
@@ -4,6 +4,23 @@ using System;
 
 namespace Lucene.Net.Expressions.JS
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     public class TestJavascriptFunction : LuceneTestCase
     {
         private static double DELTA = 0.0000001;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
index 0a3b52c..8a07ca5 100644
--- a/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
+++ b/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs
@@ -3,6 +3,23 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Expressions.JS
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     public class TestJavascriptOperations : LuceneTestCase
 	{
 		

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs b/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
index d7f1358..ac99d8e 100644
--- a/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestApiConsistency.cs
@@ -5,6 +5,23 @@ using System;
 
 namespace Lucene.Net.Expressions
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     /// <summary>
     /// LUCENENET specific tests for ensuring API conventions are followed
     /// </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs b/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
index f30f9b4..c77c134 100644
--- a/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestDemoExpressions.cs
@@ -10,6 +10,23 @@ using System.Text;
 
 namespace Lucene.Net.Expressions
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     /// <summary>simple demo of using expressions</summary>
     [SuppressCodecs("Lucene3x")]
     public class TestDemoExpressions : LuceneTestCase

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
index 4b37ccb..a5f99e5 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionRescorer.cs
@@ -8,6 +8,23 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Expressions
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     [SuppressCodecs("Lucene3x")]
 	public class TestExpressionRescorer : LuceneTestCase
 	{

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
index 23c4608..adc2294 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSortField.cs
@@ -5,6 +5,23 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Expressions
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     public class TestExpressionSortField : LuceneTestCase
 	{
 		[Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
index 1610312..aee18aa 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
@@ -10,6 +10,23 @@ using NUnit.Framework;
 
 namespace Lucene.Net.Expressions
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     /// <summary>
     /// Tests some basic expressions against different queries,
     /// and fieldcache/docvalues fields against an equivalent sort.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
index 8b117bd..7ad9647 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionValidation.cs
@@ -6,6 +6,23 @@ using System;
 
 namespace Lucene.Net.Expressions
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     /// <summary>Tests validation of bindings</summary>
     public class TestExpressionValidation : LuceneTestCase
 	{

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1d1ff899/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
index 3c8b64d..62d6719 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionValueSource.cs
@@ -11,6 +11,23 @@ using System.Collections.Generic;
 
 namespace Lucene.Net.Expressions
 {
+    /*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
     [SuppressCodecs("Lucene3x")]
 	public class TestExpressionValueSource : LuceneTestCase
 	{