lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [5/9] lucenenet git commit: Adding tests for TaskMergeScheduler
Date Sat, 28 May 2016 18:00:42 GMT
Adding tests for TaskMergeScheduler


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

Branch: refs/heads/master
Commit: 653d8a3ef05e39508a968321c2bfecd23c71e672
Parents: 473b792
Author: Connie Yau <conniey@microsoft.com>
Authored: Mon May 2 16:42:42 2016 -0700
Committer: Connie Yau <conniey@microsoft.com>
Committed: Tue May 3 11:34:20 2016 -0700

----------------------------------------------------------------------
 .../Util/LuceneTestCase.cs                      | 11 +++
 .../core/Index/Test2BBinaryDocValues.cs         | 23 +++++--
 .../core/Index/Test2BNumericDocValues.cs        |  4 +-
 .../core/Index/Test2BPositions.cs               |  4 +-
 .../core/Index/Test2BPostings.cs                | 11 ++-
 .../core/Index/Test2BPostingsBytes.cs           | 11 ++-
 .../core/Index/Test2BSortedDocValues.cs         | 19 ++++--
 src/Lucene.Net.Tests/core/Index/Test2BTerms.cs  |  8 ++-
 .../core/Index/Test4GBStoredFields.cs           | 10 ++-
 src/Lucene.Net.Tests/core/Index/TestCrash.cs    | 46 ++++++++-----
 .../core/Index/TestIndexWriter.cs               |  5 +-
 .../core/Index/TestIndexWriterConfig.cs         | 12 ++++
 .../core/Index/TestIndexWriterDelete.cs         | 23 +++++--
 .../core/Index/TestIndexWriterExceptions.cs     | 53 +++++++++-----
 .../core/Index/TestIndexWriterForceMerge.cs     |  8 ++-
 .../core/Index/TestIndexWriterMergePolicy.cs    |  9 ++-
 .../core/Index/TestIndexWriterOnDiskFull.cs     | 13 ++--
 .../core/Index/TestIndexWriterReader.cs         | 25 ++++---
 .../core/Index/TestIndexWriterWithThreads.cs    | 72 +++++++++++---------
 .../core/Index/TestStressIndexing.cs            |  6 +-
 .../core/Index/TestTransactions.cs              | 38 ++++++++---
 .../core/Search/TestSearcherManager.cs          | 20 +++---
 .../core/TestMergeSchedulerExternal.cs          |  2 +
 23 files changed, 288 insertions(+), 145 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/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 3667b87..6a217fb 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2675,6 +2675,17 @@ namespace Lucene.Net.Util
                 }
             }
         }
+
+        /// <summary>
+        /// Contains a list of all the IConcurrentMergeSchedulers to be tested.
+        /// </summary>
+        public class ConcurrentMergeSchedulers
+        {
+            public readonly IConcurrentMergeScheduler[] Values = new IConcurrentMergeScheduler[] {
+                new ConcurrentMergeScheduler(),
+                new TaskMergeScheduler()
+            };
+        }
     }
 
     /*internal class ReaderClosedListenerAnonymousInnerClassHelper : IndexReader.ReaderClosedListener

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs b/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
index a4267dc..5719833 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BBinaryDocValues.cs
@@ -42,16 +42,20 @@ namespace Lucene.Net.Index
     {
         // indexes Integer.MAX_VALUE docs with a fixed binary field
         [Test]
-        public virtual void TestFixedBinary()
+        public virtual void TestFixedBinary([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BFixedBinary"));
             if (dir is MockDirectoryWrapper)
             {
                 ((MockDirectoryWrapper)dir).Throttling = MockDirectoryWrapper.Throttling_e.NEVER;
             }
-
-            IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+            var config = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                            .SetRAMBufferSizeMB(256.0)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy(false, 10))
+                            .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE);
+            IndexWriter w = new IndexWriter(dir, config);
 
             Document doc = new Document();
             var bytes = new byte[4];
@@ -104,7 +108,7 @@ namespace Lucene.Net.Index
 
         // indexes Integer.MAX_VALUE docs with a variable binary field
         [Test]
-        public virtual void TestVariableBinary()
+        public virtual void TestVariableBinary([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BVariableBinary"));
             if (dir is MockDirectoryWrapper)
@@ -112,8 +116,13 @@ namespace Lucene.Net.Index
                 ((MockDirectoryWrapper)dir).Throttling = MockDirectoryWrapper.Throttling_e.NEVER;
             }
 
-            IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+            var config = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                            .SetRAMBufferSizeMB(256.0)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy(false, 10))
+                            .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE);
+            IndexWriter w = new IndexWriter(dir, config);
 
             Document doc = new Document();
             var bytes = new byte[4];

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs b/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
index ac25286..c62200f 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BNumericDocValues.cs
@@ -40,7 +40,7 @@ namespace Lucene.Net.Index
     {
         // indexes Integer.MAX_VALUE docs with an increasing dv field
         [Test]
-        public virtual void TestNumerics()
+        public virtual void TestNumerics([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BNumerics"));
             if (dir is MockDirectoryWrapper)
@@ -49,7 +49,7 @@ namespace Lucene.Net.Index
             }
 
             IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(scheduler).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
 
             Document doc = new Document();
             NumericDocValuesField dvField = new NumericDocValuesField("dv", 0);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test2BPositions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BPositions.cs b/src/Lucene.Net.Tests/core/Index/Test2BPositions.cs
index effef2b..b3889da 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BPositions.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BPositions.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Index
     {
         //ORIGINAL LINE: @Ignore("Very slow. Enable manually by removing @Ignore.") public void test() throws Exception
         [Test]
-        public virtual void Test()
+        public virtual void Test([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BPositions"));
             if (dir is MockDirectoryWrapper)
@@ -59,7 +59,7 @@ namespace Lucene.Net.Index
             }
 
             IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(scheduler).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
 
             MergePolicy mp = w.Config.MergePolicy;
             if (mp is LogByteSizeMergePolicy)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs b/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
index a7ee7bc..77c76ff 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
@@ -44,7 +44,7 @@ namespace Lucene.Net.Index
     public class Test2BPostings : LuceneTestCase
     {
         [Test, LongRunningTest, Timeout(int.MaxValue)]
-        public virtual void Test()
+        public virtual void Test([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BPostings"));
             if (dir is MockDirectoryWrapper)
@@ -52,9 +52,14 @@ namespace Lucene.Net.Index
                 ((MockDirectoryWrapper)dir).Throttling = MockDirectoryWrapper.Throttling_e.NEVER;
             }
 
-            IndexWriterConfig iwc = (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE);
+            var config = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                            .SetRAMBufferSizeMB(256.0)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy(false, 10))
+                            .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE);
 
-            IndexWriter w = new IndexWriter(dir, iwc);
+            IndexWriter w = new IndexWriter(dir, config);
 
             MergePolicy mp = w.Config.MergePolicy;
             if (mp is LogByteSizeMergePolicy)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs b/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
index 8fa2fad..d13a13e 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
@@ -52,7 +52,7 @@ namespace Lucene.Net.Index
     {
         //ORIGINAL LINE: @Ignore("Very slow. Enable manually by removing @Ignore.") public void test() throws Exception
         [Test]
-        public virtual void Test()
+        public virtual void Test([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BPostingsBytes1"));
             if (dir is MockDirectoryWrapper)
@@ -60,8 +60,13 @@ namespace Lucene.Net.Index
                 ((MockDirectoryWrapper)dir).Throttling = MockDirectoryWrapper.Throttling_e.NEVER;
             }
 
-            IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+            var config = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                            .SetRAMBufferSizeMB(256.0)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy(false, 10))
+                            .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE);
+            IndexWriter w = new IndexWriter(dir, config);
 
             MergePolicy mp = w.Config.MergePolicy;
             if (mp is LogByteSizeMergePolicy)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs b/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
index 842c6e3..bce3d5b 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BSortedDocValues.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.Index
     {
         // indexes Integer.MAX_VALUE docs with a fixed binary field
         [Test]
-        public virtual void TestFixedSorted()
+        public virtual void TestFixedSorted([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BFixedSorted"));
             if (dir is MockDirectoryWrapper)
@@ -48,7 +48,11 @@ namespace Lucene.Net.Index
             }
 
             IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+                                .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                                .SetRAMBufferSizeMB(256.0)
+                                .SetMergeScheduler(scheduler)
+                                .SetMergePolicy(NewLogMergePolicy(false, 10))
+                                .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
 
             Document doc = new Document();
             var bytes = new byte[2];
@@ -97,7 +101,7 @@ namespace Lucene.Net.Index
 
         // indexes Integer.MAX_VALUE docs with a fixed binary field
         [Test]
-        public virtual void Test2BOrds()
+        public virtual void Test2BOrds([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BOrds"));
             if (dir is MockDirectoryWrapper)
@@ -105,8 +109,13 @@ namespace Lucene.Net.Index
                 ((MockDirectoryWrapper)dir).Throttling = MockDirectoryWrapper.Throttling_e.NEVER;
             }
 
-            IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+            var config = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                            .SetRAMBufferSizeMB(256.0)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy(false, 10))
+                            .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE);
+            IndexWriter w = new IndexWriter(dir, config);
 
             Document doc = new Document();
             var bytes = new byte[4];

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test2BTerms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BTerms.cs b/src/Lucene.Net.Tests/core/Index/Test2BTerms.cs
index 8ed26d3..52e585c 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BTerms.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BTerms.cs
@@ -168,7 +168,7 @@ namespace Lucene.Net.Index
         //ORIGINAL LINE: @Ignore("Very slow. Enable manually by removing @Ignore.") public void test2BTerms() throws java.io.IOException
         [Ignore]
         [Test]
-        public virtual void Test2BTerms_Mem()
+        public virtual void Test2BTerms_Mem([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             if ("Lucene3x".Equals(Codec.Default.Name))
             {
@@ -192,7 +192,11 @@ namespace Lucene.Net.Index
             if (true)
             {
                 IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
-                                           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+                                           .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                                           .SetRAMBufferSizeMB(256.0)
+                                           .SetMergeScheduler(scheduler)
+                                           .SetMergePolicy(NewLogMergePolicy(false, 10))
+                                           .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
 
                 MergePolicy mp = w.Config.MergePolicy;
                 if (mp is LogByteSizeMergePolicy)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/Test4GBStoredFields.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test4GBStoredFields.cs b/src/Lucene.Net.Tests/core/Index/Test4GBStoredFields.cs
index d1bbe3d..1f55b69 100644
--- a/src/Lucene.Net.Tests/core/Index/Test4GBStoredFields.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test4GBStoredFields.cs
@@ -40,12 +40,18 @@ namespace Lucene.Net.Index
     public class Test4GBStoredFields : LuceneTestCase
     {
         [Test]
-        public virtual void Test()
+        public virtual void Test([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             MockDirectoryWrapper dir = new MockDirectoryWrapper(Random(), new MMapDirectory(CreateTempDir("4GBStoredFields")));
             dir.Throttling = MockDirectoryWrapper.Throttling_e.NEVER;
 
-            IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH).SetRAMBufferSizeMB(256.0).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(false, 10)).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
+            var config = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                            .SetRAMBufferSizeMB(256.0)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy(false, 10))
+                            .SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE);
+            IndexWriter w = new IndexWriter(dir, config);
 
             MergePolicy mp = w.Config.MergePolicy;
             if (mp is LogByteSizeMergePolicy)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestCrash.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestCrash.cs b/src/Lucene.Net.Tests/core/Index/TestCrash.cs
index 5447e03..4c13291 100644
--- a/src/Lucene.Net.Tests/core/Index/TestCrash.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestCrash.cs
@@ -33,17 +33,22 @@ namespace Lucene.Net.Index
     [TestFixture]
     public class TestCrash : LuceneTestCase
     {
-        private IndexWriter InitIndex(Random random, bool initialCommit)
+        private IndexWriter InitIndex(IConcurrentMergeScheduler scheduler, Random random, bool initialCommit)
         {
-            return InitIndex(random, NewMockDirectory(random), initialCommit);
+            return InitIndex(scheduler, random, NewMockDirectory(random), initialCommit);
         }
 
-        private IndexWriter InitIndex(Random random, MockDirectoryWrapper dir, bool initialCommit)
+        private IndexWriter InitIndex(IConcurrentMergeScheduler scheduler, Random random, MockDirectoryWrapper dir, bool initialCommit)
         {
             dir.LockFactory = NoLockFactory.DoNoLockFactory;
 
-            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).SetMaxBufferedDocs(10).SetMergeScheduler(new ConcurrentMergeScheduler()));
-            ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).SetSuppressExceptions();
+            scheduler.SetSuppressExceptions();
+
+            IndexWriter writer = new IndexWriter(dir,
+                NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))
+                .SetMaxBufferedDocs(10)
+                .SetMergeScheduler(scheduler));
+
             if (initialCommit)
             {
                 writer.Commit();
@@ -63,7 +68,7 @@ namespace Lucene.Net.Index
         private void Crash(IndexWriter writer)
         {
             MockDirectoryWrapper dir = (MockDirectoryWrapper)writer.Directory;
-            ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler)writer.Config.MergeScheduler;
+            var cms = (IConcurrentMergeScheduler)writer.Config.MergeScheduler;
             cms.Sync();
             dir.Crash();
             cms.Sync();
@@ -71,12 +76,13 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestCrashWhileIndexing()
+        public virtual void TestCrashWhileIndexing(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             // this test relies on being able to open a reader before any commit
             // happened, so we must create an initial commit just to allow that, but
             // before any documents were added.
-            IndexWriter writer = InitIndex(Random(), true);
+            IndexWriter writer = InitIndex(scheduler, Random(), true);
             MockDirectoryWrapper dir = (MockDirectoryWrapper)writer.Directory;
 
             // We create leftover files because merging could be
@@ -100,13 +106,14 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestWriterAfterCrash()
+        public virtual void TestWriterAfterCrash(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             // this test relies on being able to open a reader before any commit
             // happened, so we must create an initial commit just to allow that, but
             // before any documents were added.
             Console.WriteLine("TEST: initIndex");
-            IndexWriter writer = InitIndex(Random(), true);
+            IndexWriter writer = InitIndex(scheduler, Random(), true);
             Console.WriteLine("TEST: done initIndex");
             MockDirectoryWrapper dir = (MockDirectoryWrapper)writer.Directory;
 
@@ -117,7 +124,7 @@ namespace Lucene.Net.Index
             dir.PreventDoubleWrite = false;
             Console.WriteLine("TEST: now crash");
             Crash(writer);
-            writer = InitIndex(Random(), dir, false);
+            writer = InitIndex(scheduler, Random(), dir, false);
             writer.Dispose();
 
             IndexReader reader = DirectoryReader.Open(dir);
@@ -135,9 +142,10 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestCrashAfterReopen()
+        public virtual void TestCrashAfterReopen(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            IndexWriter writer = InitIndex(Random(), false);
+            IndexWriter writer = InitIndex(scheduler, Random(), false);
             MockDirectoryWrapper dir = (MockDirectoryWrapper)writer.Directory;
 
             // We create leftover files because merging could be
@@ -145,7 +153,7 @@ namespace Lucene.Net.Index
             dir.AssertNoUnrefencedFilesOnClose = false;
 
             writer.Dispose();
-            writer = InitIndex(Random(), dir, false);
+            writer = InitIndex(scheduler, Random(), dir, false);
             Assert.AreEqual(314, writer.MaxDoc);
             Crash(writer);
 
@@ -173,9 +181,10 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestCrashAfterClose()
+        public virtual void TestCrashAfterClose(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            IndexWriter writer = InitIndex(Random(), false);
+            IndexWriter writer = InitIndex(scheduler, Random(), false);
             MockDirectoryWrapper dir = (MockDirectoryWrapper)writer.Directory;
 
             writer.Dispose();
@@ -195,9 +204,10 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestCrashAfterCloseNoWait()
+        public virtual void TestCrashAfterCloseNoWait(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            IndexWriter writer = InitIndex(Random(), false);
+            IndexWriter writer = InitIndex(scheduler, Random(), false);
             MockDirectoryWrapper dir = (MockDirectoryWrapper)writer.Directory;
 
             writer.Dispose(false);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
index ad5782f..48332ac 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
@@ -222,13 +222,14 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestChangesAfterClose()
+        public virtual void TestChangesAfterClose([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir = NewDirectory();
 
             IndexWriter writer = null;
 
-            writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(scheduler);
+            writer = new IndexWriter(dir, config);
             AddDoc(writer);
 
             // close

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
index 954d323..7e17b27 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
@@ -61,7 +61,11 @@ namespace Lucene.Net.Index
             Assert.AreEqual(typeof(MockAnalyzer), conf.Analyzer.GetType());
             Assert.IsNull(conf.IndexCommit);
             Assert.AreEqual(typeof(KeepOnlyLastCommitDeletionPolicy), conf.DelPolicy.GetType());
+#if FEATURE_TASKMERGESCHEDULER
+            Assert.AreEqual(typeof(TaskMergeScheduler), conf.MergeScheduler.GetType());
+#else
             Assert.AreEqual(typeof(ConcurrentMergeScheduler), conf.MergeScheduler.GetType());
+#endif
             Assert.AreEqual(OpenMode_e.CREATE_OR_APPEND, conf.OpenMode);
             // we don't need to assert this, it should be unspecified
             Assert.IsTrue(IndexSearcher.DefaultSimilarity == conf.Similarity);
@@ -284,7 +288,11 @@ namespace Lucene.Net.Index
             Assert.IsTrue(mergeSched.GetType() == mergeSchedClone.GetType() && (mergeSched != mergeSchedClone || mergeSched.Clone() == mergeSchedClone.Clone()));
 
             conf.SetMergeScheduler(new SerialMergeScheduler());
+#if FEATURE_TASKMERGESCHEDULER
+            Assert.AreEqual(typeof(TaskMergeScheduler), clone.MergeScheduler.GetType());
+#else
             Assert.AreEqual(typeof(ConcurrentMergeScheduler), clone.MergeScheduler.GetType());
+#endif
         }
 
         [Test]
@@ -307,7 +315,11 @@ namespace Lucene.Net.Index
             }
 
             // Test MergeScheduler
+#if FEATURE_TASKMERGESCHEDULER
+            Assert.AreEqual(typeof(TaskMergeScheduler), conf.MergeScheduler.GetType());
+#else
             Assert.AreEqual(typeof(ConcurrentMergeScheduler), conf.MergeScheduler.GetType());
+#endif
             conf.SetMergeScheduler(new SerialMergeScheduler());
             Assert.AreEqual(typeof(SerialMergeScheduler), conf.MergeScheduler.GetType());
             try

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
index cce436e..3d321d3 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
@@ -542,22 +542,24 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestDeletesOnDiskFull()
+        public virtual void TestDeletesOnDiskFull(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            DoTestOperationsOnDiskFull(false);
+            DoTestOperationsOnDiskFull(scheduler, false);
         }
 
         [Test]
-        public virtual void TestUpdatesOnDiskFull()
+        public virtual void TestUpdatesOnDiskFull(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            DoTestOperationsOnDiskFull(true);
+            DoTestOperationsOnDiskFull(scheduler, true);
         }
 
         /// <summary>
         /// Make sure if modifier tries to commit but hits disk full that modifier
         /// remains consistent and usable. Similar to TestIndexReader.testDiskFull().
         /// </summary>
-        private void DoTestOperationsOnDiskFull(bool updates)
+        private void DoTestOperationsOnDiskFull(IConcurrentMergeScheduler scheduler, bool updates)
         {
             Term searchTerm = new Term("content", "aaa");
             int START_COUNT = 157;
@@ -598,8 +600,15 @@ namespace Lucene.Net.Index
                 MockDirectoryWrapper dir = new MockDirectoryWrapper(Random(), new RAMDirectory(startDir, NewIOContext(Random())));
                 dir.PreventDoubleWrite = false;
                 dir.AllowRandomFileNotFoundException = false;
-                IndexWriter modifier = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false)).SetMaxBufferedDocs(1000).SetMaxBufferedDeleteTerms(1000).SetMergeScheduler(new ConcurrentMergeScheduler()));
-                ((ConcurrentMergeScheduler)modifier.Config.MergeScheduler).SetSuppressExceptions();
+
+                var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false))
+                                .SetMaxBufferedDocs(1000)
+                                .SetMaxBufferedDeleteTerms(1000)
+                                .SetMergeScheduler(scheduler);
+
+                scheduler.SetSuppressExceptions();
+
+                IndexWriter modifier = new IndexWriter(dir, config);
 
                 // For each disk size, first try to commit against
                 // dir that will hit random IOExceptions & disk

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
index 34bba74..6821109 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
@@ -310,7 +310,7 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestRandomExceptions()
+        public virtual void TestRandomExceptions([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             if (VERBOSE)
             {
@@ -321,8 +321,14 @@ namespace Lucene.Net.Index
             MockAnalyzer analyzer = new MockAnalyzer(Random());
             analyzer.EnableChecks = false; // disable workflow checking as we forcefully close() in exceptional cases.
 
-            IndexWriter writer = RandomIndexWriter.MockIndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer).SetRAMBufferSizeMB(0.1).SetMergeScheduler(new ConcurrentMergeScheduler()), new TestPoint1(this));
-            ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).SetSuppressExceptions();
+
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)
+                            .SetRAMBufferSizeMB(0.1)
+                            .SetMergeScheduler(scheduler);
+
+            scheduler.SetSuppressExceptions();
+
+            IndexWriter writer = RandomIndexWriter.MockIndexWriter(dir, config , new TestPoint1(this));
             //writer.SetMaxBufferedDocs(10);
             if (VERBOSE)
             {
@@ -366,13 +372,19 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestRandomExceptionsThreads()
+        public virtual void TestRandomExceptionsThreads([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir = NewDirectory();
             MockAnalyzer analyzer = new MockAnalyzer(Random());
             analyzer.EnableChecks = false; // disable workflow checking as we forcefully close() in exceptional cases.
-            IndexWriter writer = RandomIndexWriter.MockIndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer).SetRAMBufferSizeMB(0.2).SetMergeScheduler(new ConcurrentMergeScheduler()), new TestPoint1(this));
-            ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).SetSuppressExceptions();
+
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)
+                            .SetRAMBufferSizeMB(0.2)
+                            .SetMergeScheduler(scheduler);
+
+            IndexWriter writer = RandomIndexWriter.MockIndexWriter(dir, config, new TestPoint1(this));
+            scheduler.SetSuppressExceptions();
+
             //writer.SetMaxBufferedDocs(10);
             writer.Commit();
 
@@ -553,13 +565,13 @@ namespace Lucene.Net.Index
 
         // LUCENE-1210
         [Test]
-        public virtual void TestExceptionOnMergeInit()
+        public virtual void TestExceptionOnMergeInit([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir = NewDirectory();
             IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergePolicy(NewLogMergePolicy());
-            ConcurrentMergeScheduler cms = new ConcurrentMergeScheduler();
-            cms.SetSuppressExceptions();
-            conf.SetMergeScheduler(cms);
+
+            scheduler.SetSuppressExceptions();
+            conf.SetMergeScheduler(scheduler);
             ((LogMergePolicy)conf.MergePolicy).MergeFactor = 2;
             TestPoint3 testPoint = new TestPoint3();
             IndexWriter w = RandomIndexWriter.MockIndexWriter(dir, conf, testPoint);
@@ -572,13 +584,13 @@ namespace Lucene.Net.Index
                 {
                     w.AddDocument(doc);
                 }
-                catch (Exception re)
+                catch (Exception)
                 {
                     break;
                 }
             }
 
-            ((ConcurrentMergeScheduler)w.Config.MergeScheduler).Sync();
+            ((IConcurrentMergeScheduler)w.Config.MergeScheduler).Sync();
             Assert.IsTrue(testPoint.Failed);
             w.Dispose();
             dir.Dispose();
@@ -1088,13 +1100,18 @@ namespace Lucene.Net.Index
 
         // LUCENE-1044: test exception during sync
         [Test]
-        public virtual void TestExceptionDuringSync()
+        public virtual void TestExceptionDuringSync([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             MockDirectoryWrapper dir = NewMockDirectory();
             FailOnlyInSync failure = new FailOnlyInSync();
             dir.FailOn(failure);
 
-            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(5)));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(2)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy(5));
+
+            IndexWriter writer = new IndexWriter(dir, config);
             failure.SetDoFail();
 
             for (int i = 0; i < 23; i++)
@@ -1112,7 +1129,7 @@ namespace Lucene.Net.Index
                     }
                 }
             }
-            ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).Sync();
+            ((IConcurrentMergeScheduler)writer.Config.MergeScheduler).Sync();
             Assert.IsTrue(failure.DidFail);
             failure.ClearDoFail();
             writer.Dispose();
@@ -1221,7 +1238,7 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestForceMergeExceptions()
+        public virtual void TestForceMergeExceptions([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory startDir = NewDirectory();
             IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergePolicy(NewLogMergePolicy());
@@ -1241,8 +1258,8 @@ namespace Lucene.Net.Index
                     Console.WriteLine("TEST: iter " + i);
                 }
                 MockDirectoryWrapper dir = new MockDirectoryWrapper(Random(), new RAMDirectory(startDir, NewIOContext(Random())));
-                conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(new ConcurrentMergeScheduler());
-                ((ConcurrentMergeScheduler)conf.MergeScheduler).SetSuppressExceptions();
+                conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(scheduler);
+                scheduler.SetSuppressExceptions();
                 w = new IndexWriter(dir, conf);
                 dir.RandomIOExceptionRate = 0.5;
                 try

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterForceMerge.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterForceMerge.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterForceMerge.cs
index 8d05d83..debf331 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterForceMerge.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterForceMerge.cs
@@ -81,7 +81,7 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestMaxNumSegments2()
+        public virtual void TestMaxNumSegments2([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir = NewDirectory();
 
@@ -91,7 +91,11 @@ namespace Lucene.Net.Index
             LogDocMergePolicy ldmp = new LogDocMergePolicy();
             ldmp.MinMergeDocs = 1;
             ldmp.MergeFactor = 4;
-            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergePolicy(ldmp).SetMergeScheduler(new ConcurrentMergeScheduler()));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(2)
+                            .SetMergePolicy(ldmp)
+                            .SetMergeScheduler(scheduler);
+            IndexWriter writer = new IndexWriter(dir, config);
 
             for (int iter = 0; iter < 10; iter++)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterMergePolicy.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterMergePolicy.cs
index 869a301..ca66e9a 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterMergePolicy.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterMergePolicy.cs
@@ -178,7 +178,7 @@ namespace Lucene.Net.Index
 
         // Test the case where a merge results in no doc at all
         [Test]
-        public virtual void TestMergeDocCount0()
+        public virtual void TestMergeDocCount0([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir = NewDirectory();
 
@@ -200,7 +200,12 @@ namespace Lucene.Net.Index
 
             ldmp = new LogDocMergePolicy();
             ldmp.MergeFactor = 5;
-            writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetOpenMode(OpenMode_e.APPEND).SetMaxBufferedDocs(10).SetMergePolicy(ldmp).SetMergeScheduler(new ConcurrentMergeScheduler()));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                .SetOpenMode(OpenMode_e.APPEND)
+                .SetMaxBufferedDocs(10)
+                .SetMergePolicy(ldmp)
+                .SetMergeScheduler(scheduler);
+            writer = new IndexWriter(dir, config);
 
             // merge factor is changed, so check invariants after all adds
             for (int i = 0; i < 10; i++)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterOnDiskFull.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterOnDiskFull.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterOnDiskFull.cs
index 75aeb19..5dd0001 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterOnDiskFull.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterOnDiskFull.cs
@@ -631,10 +631,13 @@ namespace Lucene.Net.Index
         // an IndexWriter (hit during DW.ThreadState.Init()) is
         // OK:
         [Test]
-        public virtual void TestImmediateDiskFull()
+        public virtual void TestImmediateDiskFull([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             MockDirectoryWrapper dir = NewMockDirectory();
-            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergeScheduler(new ConcurrentMergeScheduler()));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(2)
+                            .SetMergeScheduler(scheduler);
+            IndexWriter writer = new IndexWriter(dir, config);
             dir.MaxSizeInBytes = Math.Max(1, dir.RecomputedActualSizeInBytes);
             Document doc = new Document();
             FieldType customType = new FieldType(TextField.TYPE_STORED);
@@ -644,7 +647,7 @@ namespace Lucene.Net.Index
                 writer.AddDocument(doc);
                 Assert.Fail("did not hit disk full");
             }
-            catch (IOException ioe)
+            catch (IOException)
             {
             }
             // Without fix for LUCENE-1130: this call will hang:
@@ -653,7 +656,7 @@ namespace Lucene.Net.Index
                 writer.AddDocument(doc);
                 Assert.Fail("did not hit disk full");
             }
-            catch (IOException ioe)
+            catch (IOException)
             {
             }
             try
@@ -661,7 +664,7 @@ namespace Lucene.Net.Index
                 writer.Dispose(false);
                 Assert.Fail("did not hit disk full");
             }
-            catch (IOException ioe)
+            catch (IOException)
             {
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
index 2d97f09..051fd98 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
@@ -741,12 +741,17 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestMergeWarmer()
+        public virtual void TestMergeWarmer([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir1 = GetAssertNoDeletesDirectory(NewDirectory());
             // Enroll warmer
             MyWarmer warmer = new MyWarmer();
-            IndexWriter writer = new IndexWriter(dir1, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergedSegmentWarmer(warmer).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy()));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMaxBufferedDocs(2)
+                            .SetMergedSegmentWarmer(warmer)
+                            .SetMergeScheduler(scheduler)
+                            .SetMergePolicy(NewLogMergePolicy());
+            IndexWriter writer = new IndexWriter(dir1, config);
 
             // create the index
             CreateIndexNoClose(false, "test", writer);
@@ -756,17 +761,20 @@ namespace Lucene.Net.Index
 
             ((LogMergePolicy)writer.Config.MergePolicy).MergeFactor = 2;
 
-            int num = AtLeast(100);
+            //int num = AtLeast(100);
+            int num = 101;
             for (int i = 0; i < num; i++)
             {
                 writer.AddDocument(DocHelper.CreateDocument(i, "test", 4));
             }
-            ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).Sync();
+            ((IConcurrentMergeScheduler)writer.Config.MergeScheduler).Sync();
 
             Assert.IsTrue(warmer.WarmCount > 0);
+            Console.WriteLine("Count {0}", warmer.WarmCount);
             int count = warmer.WarmCount;
 
-            writer.AddDocument(DocHelper.CreateDocument(17, "test", 4));
+            var newDocument = DocHelper.CreateDocument(17, "test", 4);
+            writer.AddDocument(newDocument);
             writer.ForceMerge(1);
             Assert.IsTrue(warmer.WarmCount > count);
 
@@ -776,10 +784,11 @@ namespace Lucene.Net.Index
         }
 
         [Test]
-        public virtual void TestAfterCommit()
+        public virtual void TestAfterCommit([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir1 = GetAssertNoDeletesDirectory(NewDirectory());
-            IndexWriter writer = new IndexWriter(dir1, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(new ConcurrentMergeScheduler()));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(scheduler);
+            IndexWriter writer = new IndexWriter(dir1, config);
             writer.Commit();
 
             // create the index
@@ -796,7 +805,7 @@ namespace Lucene.Net.Index
             {
                 writer.AddDocument(DocHelper.CreateDocument(i, "test", 4));
             }
-            ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).Sync();
+            ((IConcurrentMergeScheduler)writer.Config.MergeScheduler).Sync();
 
             DirectoryReader r2 = DirectoryReader.OpenIfChanged(r1);
             if (r2 != null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
index a1bbdcc..0e1d1e7 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
@@ -145,7 +145,7 @@ namespace Lucene.Net.Index
         // an IndexWriter (hit during DW.ThreadState.Init()), with
         // multiple threads, is OK:
         [Test]
-        public virtual void TestImmediateDiskFullWithThreads()
+        public virtual void TestImmediateDiskFullWithThreads([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             int NUM_THREADS = 3;
             int numIterations = TEST_NIGHTLY ? 10 : 3;
@@ -156,8 +156,12 @@ namespace Lucene.Net.Index
                     Console.WriteLine("\nTEST: iter=" + iter);
                 }
                 MockDirectoryWrapper dir = NewMockDirectory();
-                IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(4)));
-                ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).SetSuppressExceptions();
+                var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                                .SetMaxBufferedDocs(2)
+                                .SetMergeScheduler(scheduler)
+                                .SetMergePolicy(NewLogMergePolicy(4));
+                IndexWriter writer = new IndexWriter(dir, config);
+                scheduler.SetSuppressExceptions();
                 dir.MaxSizeInBytes = 4 * 1024 + 20 * iter;
 
                 IndexerThread[] threads = new IndexerThread[NUM_THREADS];
@@ -193,7 +197,7 @@ namespace Lucene.Net.Index
         // speaking, this isn't valid us of Lucene's APIs, but we
         // still want to be robust to this case:
         [Test]
-        public virtual void TestCloseWithThreads()
+        public virtual void TestCloseWithThreads([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             int NUM_THREADS = 3;
             int numIterations = TEST_NIGHTLY ? 7 : 3;
@@ -204,9 +208,12 @@ namespace Lucene.Net.Index
                     Console.WriteLine("\nTEST: iter=" + iter);
                 }
                 Directory dir = NewDirectory();
-
-                IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(10).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(4)));
-                ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).SetSuppressExceptions();
+                var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                                .SetMaxBufferedDocs(10)
+                                .SetMergeScheduler(scheduler)
+                                .SetMergePolicy(NewLogMergePolicy(4));
+                IndexWriter writer = new IndexWriter(dir, config);
+                scheduler.SetSuppressExceptions();
 
                 IndexerThread[] threads = new IndexerThread[NUM_THREADS];
 
@@ -274,7 +281,7 @@ namespace Lucene.Net.Index
 
         // Runs test, with multiple threads, using the specific
         // failure to trigger an IOException
-        public virtual void _testMultipleThreadsFailure(MockDirectoryWrapper.Failure failure)
+        public virtual void TestMultipleThreadsFailure(IConcurrentMergeScheduler scheduler, MockDirectoryWrapper.Failure failure)
         {
             int NUM_THREADS = 3;
 
@@ -285,9 +292,12 @@ namespace Lucene.Net.Index
                     Console.WriteLine("TEST: iter=" + iter);
                 }
                 MockDirectoryWrapper dir = NewMockDirectory();
-
-                IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(4)));
-                ((ConcurrentMergeScheduler)writer.Config.MergeScheduler).SetSuppressExceptions();
+                var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                                .SetMaxBufferedDocs(2)
+                                .SetMergeScheduler(scheduler)
+                                .SetMergePolicy(NewLogMergePolicy(4));
+                IndexWriter writer = new IndexWriter(dir, config);
+                scheduler.SetSuppressExceptions();
 
                 IndexerThread[] threads = new IndexerThread[NUM_THREADS];
 
@@ -318,7 +328,7 @@ namespace Lucene.Net.Index
                     writer.Dispose(false);
                     success = true;
                 }
-                catch (IOException ioe)
+                catch (IOException)
                 {
                     failure.ClearDoFail();
                     writer.Dispose(false);
@@ -349,11 +359,11 @@ namespace Lucene.Net.Index
 
         // Runs test, with one thread, using the specific failure
         // to trigger an IOException
-        public virtual void _testSingleThreadFailure(MockDirectoryWrapper.Failure failure)
+        public virtual void TestSingleThreadFailure(IConcurrentMergeScheduler scheduler, MockDirectoryWrapper.Failure failure)
         {
             MockDirectoryWrapper dir = NewMockDirectory();
 
-            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergeScheduler(new ConcurrentMergeScheduler()));
+            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2).SetMergeScheduler(scheduler));
             Document doc = new Document();
             FieldType customType = new FieldType(TextField.TYPE_STORED);
             customType.StoreTermVectors = true;
@@ -375,7 +385,7 @@ namespace Lucene.Net.Index
                 writer.Commit();
                 Assert.Fail("did not hit exception");
             }
-            catch (IOException ioe)
+            catch (IOException)
             {
             }
             failure.ClearDoFail();
@@ -446,33 +456,33 @@ namespace Lucene.Net.Index
         // LUCENE-1130: make sure initial IOException, and then 2nd
         // IOException during rollback(), is OK:
         [Test]
-        public virtual void TestIOExceptionDuringAbort()
+        public virtual void TestIOExceptionDuringAbort([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testSingleThreadFailure(new FailOnlyOnAbortOrFlush(false));
+            TestSingleThreadFailure(scheduler, new FailOnlyOnAbortOrFlush(false));
         }
 
         // LUCENE-1130: make sure initial IOException, and then 2nd
         // IOException during rollback(), is OK:
         [Test]
-        public virtual void TestIOExceptionDuringAbortOnlyOnce()
+        public virtual void TestIOExceptionDuringAbortOnlyOnce([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testSingleThreadFailure(new FailOnlyOnAbortOrFlush(true));
+            TestSingleThreadFailure(scheduler, new FailOnlyOnAbortOrFlush(true));
         }
 
         // LUCENE-1130: make sure initial IOException, and then 2nd
         // IOException during rollback(), with multiple threads, is OK:
         [Test]
-        public virtual void TestIOExceptionDuringAbortWithThreads()
+        public virtual void TestIOExceptionDuringAbortWithThreads([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testMultipleThreadsFailure(new FailOnlyOnAbortOrFlush(false));
+            TestMultipleThreadsFailure(scheduler, new FailOnlyOnAbortOrFlush(false));
         }
 
         // LUCENE-1130: make sure initial IOException, and then 2nd
         // IOException during rollback(), with multiple threads, is OK:
         [Test]
-        public virtual void TestIOExceptionDuringAbortWithThreadsOnlyOnce()
+        public virtual void TestIOExceptionDuringAbortWithThreadsOnlyOnce([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testMultipleThreadsFailure(new FailOnlyOnAbortOrFlush(true));
+            TestMultipleThreadsFailure(scheduler, new FailOnlyOnAbortOrFlush(true));
         }
 
         // Throws IOException during DocumentsWriter.writeSegment
@@ -510,30 +520,30 @@ namespace Lucene.Net.Index
 
         // LUCENE-1130: test IOException in writeSegment
         [Test]
-        public virtual void TestIOExceptionDuringWriteSegment()
+        public virtual void TestIOExceptionDuringWriteSegment([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testSingleThreadFailure(new FailOnlyInWriteSegment(false));
+            TestSingleThreadFailure(scheduler, new FailOnlyInWriteSegment(false));
         }
 
         // LUCENE-1130: test IOException in writeSegment
         [Test]
-        public virtual void TestIOExceptionDuringWriteSegmentOnlyOnce()
+        public virtual void TestIOExceptionDuringWriteSegmentOnlyOnce([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testSingleThreadFailure(new FailOnlyInWriteSegment(true));
+            TestSingleThreadFailure(scheduler, new FailOnlyInWriteSegment(true));
         }
 
         // LUCENE-1130: test IOException in writeSegment, with threads
         [Test]
-        public virtual void TestIOExceptionDuringWriteSegmentWithThreads()
+        public virtual void TestIOExceptionDuringWriteSegmentWithThreads([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testMultipleThreadsFailure(new FailOnlyInWriteSegment(false));
+            TestMultipleThreadsFailure(scheduler, new FailOnlyInWriteSegment(false));
         }
 
         // LUCENE-1130: test IOException in writeSegment, with threads
         [Test]
-        public virtual void TestIOExceptionDuringWriteSegmentWithThreadsOnlyOnce()
+        public virtual void TestIOExceptionDuringWriteSegmentWithThreadsOnlyOnce([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
-            _testMultipleThreadsFailure(new FailOnlyInWriteSegment(true));
+            TestMultipleThreadsFailure(scheduler, new FailOnlyInWriteSegment(true));
         }
 
         //  LUCENE-3365: Test adding two documents with the same field from two different IndexWriters

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs b/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
index 1b19afa..59a9baf 100644
--- a/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
@@ -147,7 +147,7 @@ namespace Lucene.Net.Index
           stress test.
         */
 
-        public virtual void RunStressTest(Directory directory, MergeScheduler mergeScheduler)
+        public virtual void RunStressTest(Directory directory, IConcurrentMergeScheduler mergeScheduler)
         {
             IndexWriter modifier = new IndexWriter(directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetOpenMode(OpenMode_e.CREATE).SetMaxBufferedDocs(10).SetMergeScheduler(mergeScheduler));
             modifier.Commit();
@@ -198,7 +198,7 @@ namespace Lucene.Net.Index
         */
 
         [Test]
-        public virtual void TestStressIndexAndSearching()
+        public virtual void TestStressIndexAndSearching([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory directory = NewDirectory();
             MockDirectoryWrapper wrapper = directory as MockDirectoryWrapper;
@@ -207,7 +207,7 @@ namespace Lucene.Net.Index
                 wrapper.AssertNoUnrefencedFilesOnClose = true;
             }
 
-            RunStressTest(directory, new ConcurrentMergeScheduler());
+            RunStressTest(directory, scheduler);
             directory.Dispose();
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestTransactions.cs b/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
index 2dba7c9..0bba56f 100644
--- a/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
@@ -111,15 +111,21 @@ namespace Lucene.Net.Index
         private class IndexerThread : TimedThread
         {
             private readonly TestTransactions OuterInstance;
-
+            private IConcurrentMergeScheduler _scheduler1;
+            private IConcurrentMergeScheduler _scheduler2;
             internal Directory Dir1;
             internal Directory Dir2;
             internal object @lock;
             internal int NextID;
 
-            public IndexerThread(TestTransactions outerInstance, object @lock, Directory dir1, Directory dir2, TimedThread[] threads)
+            public IndexerThread(TestTransactions outerInstance, object @lock, 
+                Directory dir1, Directory dir2,
+                IConcurrentMergeScheduler scheduler1, IConcurrentMergeScheduler scheduler2, 
+                TimedThread[] threads)
                 : base(threads)
             {
+                _scheduler1 = scheduler1;
+                _scheduler2 = scheduler2;
                 this.OuterInstance = outerInstance;
                 this.@lock = @lock;
                 this.Dir1 = dir1;
@@ -128,13 +134,21 @@ namespace Lucene.Net.Index
 
             public override void DoWork()
             {
-                IndexWriter writer1 = new IndexWriter(Dir1, ((IndexWriterConfig)NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(3)).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(2)));
-                ((ConcurrentMergeScheduler)writer1.Config.MergeScheduler).SetSuppressExceptions();
+                var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                                .SetMaxBufferedDocs(3)
+                                .SetMergeScheduler(_scheduler1)
+                                .SetMergePolicy(NewLogMergePolicy(2));
+                IndexWriter writer1 = new IndexWriter(Dir1, config);
+                ((IConcurrentMergeScheduler)writer1.Config.MergeScheduler).SetSuppressExceptions();
 
                 // Intentionally use different params so flush/merge
                 // happen @ different times
-                IndexWriter writer2 = new IndexWriter(Dir2, ((IndexWriterConfig)NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2)).SetMergeScheduler(new ConcurrentMergeScheduler()).SetMergePolicy(NewLogMergePolicy(3)));
-                ((ConcurrentMergeScheduler)writer2.Config.MergeScheduler).SetSuppressExceptions();
+                var config2 = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                                .SetMaxBufferedDocs(2)
+                                .SetMergeScheduler(_scheduler2)
+                                .SetMergePolicy(NewLogMergePolicy(3));
+                IndexWriter writer2 = new IndexWriter(Dir2, config2);
+                ((IConcurrentMergeScheduler)writer2.Config.MergeScheduler).SetSuppressExceptions();
 
                 Update(writer1);
                 Update(writer2);
@@ -148,7 +162,7 @@ namespace Lucene.Net.Index
                         {
                             writer1.PrepareCommit();
                         }
-                        catch (Exception t)
+                        catch (Exception)
                         {
                             writer1.Rollback();
                             writer2.Rollback();
@@ -158,7 +172,7 @@ namespace Lucene.Net.Index
                         {
                             writer2.PrepareCommit();
                         }
-                        catch (Exception t)
+                        catch (Exception)
                         {
                             writer1.Rollback();
                             writer2.Rollback();
@@ -265,8 +279,10 @@ namespace Lucene.Net.Index
             writer.Dispose();
         }
 
-        [Test]
-        public virtual void TestTransactions_Mem()
+        [Test, Sequential]
+        public virtual void TestTransactions_Mem(
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler1, 
+            [ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler2)
         {
             Console.WriteLine("Start test");
             // we cant use non-ramdir on windows, because this test needs to double-write.
@@ -290,7 +306,7 @@ namespace Lucene.Net.Index
             TimedThread[] threads = new TimedThread[3];
             int numThread = 0;
 
-            IndexerThread indexerThread = new IndexerThread(this, this, dir1, dir2, threads);
+            IndexerThread indexerThread = new IndexerThread(this, this, dir1, dir2, scheduler1, scheduler2, threads);
             threads[numThread++] = indexerThread;
             indexerThread.Start();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
index aedc8e5..a175d0f 100644
--- a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
 
 namespace Lucene.Net.Search
 {
+    using Index;
     using Lucene.Net.Randomized.Generators;
     using Lucene.Net.Support;
     using NUnit.Framework;
@@ -388,7 +389,7 @@ namespace Lucene.Net.Search
                     SearcherManager.MaybeRefresh();
                     Success.Set(true);
                 }
-                catch (AlreadyClosedException e)
+                catch (AlreadyClosedException)
                 {
                     // expected
                 }
@@ -419,10 +420,12 @@ namespace Lucene.Net.Search
         }
 
         [Test]
-        public virtual void TestReferenceDecrementIllegally()
+        public virtual void TestReferenceDecrementIllegally([ValueSource(typeof(ConcurrentMergeSchedulers), "Values")]IConcurrentMergeScheduler scheduler)
         {
             Directory dir = NewDirectory();
-            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(new ConcurrentMergeScheduler()));
+            var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                            .SetMergeScheduler(scheduler);
+            IndexWriter writer = new IndexWriter(dir, config);
             SearcherManager sm = new SearcherManager(writer, false, new SearcherFactory());
             writer.AddDocument(new Document());
             writer.Commit();
@@ -436,15 +439,8 @@ namespace Lucene.Net.Search
             acquire = sm.Acquire();
             acquire.IndexReader.DecRef();
             sm.Release(acquire);
-            try
-            {
-                sm.Acquire();
-                Assert.Fail("acquire should have thrown an InvalidOperationException since we modified the refCount outside of the manager");
-            }
-            catch (InvalidOperationException ex)
-            {
-                //
-            }
+
+            Assert.Throws<InvalidOperationException>(() => sm.Acquire(), "acquire should have thrown an InvalidOperationException since we modified the refCount outside of the manager");
 
             // sm.Dispose(); -- already closed
             writer.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/653d8a3e/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs b/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
index 59a7ffd..f68fb8a 100644
--- a/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
+++ b/src/Lucene.Net.Tests/core/TestMergeSchedulerExternal.cs
@@ -76,7 +76,9 @@ namespace Lucene.Net.Tests
             {
                 MergeThread thread = new MyMergeThread(this, writer, merge);
                 thread.ThreadPriority = MergeThreadPriority;
+#if !FEATURE_TASKMERGESCHEDULER
                 thread.SetDaemon(true);
+#endif
                 thread.Name = "MyMergeThread";
                 return thread;
             }


Mime
View raw message