lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [2/2] lucenenet git commit: Missing the IndexWriterConfig was missing SetCheckIntegrityAtMerge method.
Date Tue, 03 Feb 2015 23:56:34 GMT
Missing the IndexWriterConfig was missing SetCheckIntegrityAtMerge method.

C# does not have the synthetic flag so I changed it to look at the DeclaringType of the method
to understand if it was a method from the LiveIndexWriterConfig. This allowed me to enable
the check to ensure all setters are properly overridden.

Conflicts:
	src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs


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

Branch: refs/heads/master
Commit: 511507fbb12cc0a34cf34a58a3ef7cecb46cc1e0
Parents: 692b43c
Author: Chand2048 <Chand@Microsoft.com>
Authored: Mon Feb 2 11:33:20 2015 -0800
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Wed Feb 4 01:49:46 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/IndexWriterConfig.cs      |  5 +++++
 .../core/Index/TestIndexWriterConfig.cs             | 16 ++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/511507fb/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexWriterConfig.cs b/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
index ed6c6e5..cf13334 100644
--- a/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
@@ -704,6 +704,11 @@ namespace Lucene.Net.Index
             return (IndexWriterConfig)base.SetUseCompoundFile(useCompoundFile);
         }
 
+        public IndexWriterConfig SetCheckIntegrityAtMerge(bool checkIntegrityAtMerge)
+        {
+            return (IndexWriterConfig)base.SetCheckIntegrityAtMerge(checkIntegrityAtMerge);
+        }
+
         public override string ToString()
         {
             StringBuilder sb = new StringBuilder(base.ToString());

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/511507fb/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 514b7f0..215d1d4 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterConfig.cs
@@ -127,28 +127,28 @@ namespace Lucene.Net.Index
             HashSet<string> allSetters = new HashSet<string>();
             foreach (MethodInfo m in typeof(IndexWriterConfig).GetMethods())
             {
-                if (m.Name.StartsWith("set") && !m.IsStatic)
+                if (m.Name.StartsWith("Set") && !m.IsStatic)
                 {
                     allSetters.Add(m.Name);
                     // setters overridden from LiveIndexWriterConfig are returned twice,
once with
                     // IndexWriterConfig return type and second with LiveIndexWriterConfig.
The ones
                     // from LiveIndexWriterConfig are marked 'synthetic', so just collect
them and
                     // assert in the end that we also received them from IWC.
-                    // LUCENENET TODO
-                    /*if (m.Synthetic)
+                    // In C# we do not have them marked synthetic so we look at the declaring
type instead.
+                    if (m.DeclaringType.Name == "LiveIndexWriterConfig")
                     {
                         liveSetters.Add(m.Name);
                     }
                     else
-                    {*/
-                    Assert.AreEqual(typeof(IndexWriterConfig), m.ReturnType, "method " +
m.Name + " does not return IndexWriterConfig");
-                    //}
+                    {
+                        Assert.AreEqual(typeof(IndexWriterConfig), m.ReturnType, "method
" + m.Name + " does not return IndexWriterConfig");
+                    }
                 }
             }
-            /*foreach (string setter in liveSetters)
+            foreach (string setter in liveSetters)
             {
                 Assert.IsTrue(allSetters.Contains(setter), "setter method not overridden
by IndexWriterConfig: " + setter);
-            }*/
+            }
         }
 
         [Test]


Mime
View raw message