lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [01/52] [abbrv] lucenenet git commit: SWEEP: Moved BreakIterator-dependent functionality to a common Lucene.Net.Icu library so we can manage the icu.net dependency from one place and not make the majority of the users deal with it when they don't need to
Date Tue, 25 Apr 2017 11:50:42 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 44430e214 -> 1495bff05


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/Support/TestApiConsistency.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Icu/Support/TestApiConsistency.cs b/src/Lucene.Net.Tests.Icu/Support/TestApiConsistency.cs
new file mode 100644
index 0000000..1a143eb
--- /dev/null
+++ b/src/Lucene.Net.Tests.Icu/Support/TestApiConsistency.cs
@@ -0,0 +1,126 @@
+using Lucene.Net.Attributes;
+using NUnit.Framework;
+using System;
+
+namespace Lucene.Net.Support
+{
+    /// <summary>
+    /// LUCENENET specific tests for ensuring API conventions are followed
+    /// </summary>
+    public class TestApiConsistency : ApiScanTestBase
+    {
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestProtectedFieldNames(Type typeFromTargetAssembly)
+        {
+            base.TestProtectedFieldNames(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestPrivateFieldNames(Type typeFromTargetAssembly)
+        {
+            base.TestPrivateFieldNames(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestPublicFields(Type typeFromTargetAssembly)
+        {
+            base.TestPublicFields(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestMethodParameterNames(Type typeFromTargetAssembly)
+        {
+            base.TestMethodParameterNames(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestInterfaceNames(Type typeFromTargetAssembly)
+        {
+            base.TestInterfaceNames(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestClassNames(Type typeFromTargetAssembly)
+        {
+            base.TestClassNames(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForPropertiesWithNoGetter(Type typeFromTargetAssembly)
+        {
+            base.TestForPropertiesWithNoGetter(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForPropertiesThatReturnArray(Type typeFromTargetAssembly)
+        {
+            base.TestForPropertiesThatReturnArray(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForMethodsThatReturnWritableArray(Type typeFromTargetAssembly)
+        {
+            base.TestForMethodsThatReturnWritableArray(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForPublicMembersContainingComparer(Type typeFromTargetAssembly)
+        {
+            base.TestForPublicMembersContainingComparer(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForPublicMembersNamedSize(Type typeFromTargetAssembly)
+        {
+            base.TestForPublicMembersNamedSize(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForPublicMembersContainingNonNetNumeric(Type typeFromTargetAssembly)
+        {
+            base.TestForPublicMembersContainingNonNetNumeric(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForTypesContainingNonNetNumeric(Type typeFromTargetAssembly)
+        {
+            base.TestForTypesContainingNonNetNumeric(typeFromTargetAssembly);
+        }
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForPublicMembersWithNullableEnum(Type typeFromTargetAssembly)
+        {
+            base.TestForPublicMembersWithNullableEnum(typeFromTargetAssembly);
+        }
+
+        // LUCENENET NOTE: This test is only for identifying members who were changed from
+        // ICollection, IList or ISet to IEnumerable during the port (that should be changed
back)
+        //[Test, LuceneNetSpecific]
+        //[TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        //public override void TestForMembersAcceptingOrReturningIEnumerable(Type typeFromTargetAssembly)
+        //{
+        //    base.TestForMembersAcceptingOrReturningIEnumerable(typeFromTargetAssembly);
+        //}
+
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Search.Highlight.DefaultEncoder))]
+        public override void TestForMembersAcceptingOrReturningListOrDictionary(Type typeFromTargetAssembly)
+        {
+            base.TestForMembersAcceptingOrReturningListOrDictionary(typeFromTargetAssembly);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/Support/TestExceptionSerialization.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Icu/Support/TestExceptionSerialization.cs b/src/Lucene.Net.Tests.Icu/Support/TestExceptionSerialization.cs
new file mode 100644
index 0000000..ad84905
--- /dev/null
+++ b/src/Lucene.Net.Tests.Icu/Support/TestExceptionSerialization.cs
@@ -0,0 +1,54 @@
+#if FEATURE_SERIALIZABLE
+using Lucene.Net.Attributes;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Lucene.Net.Support
+{
+    /*
+     * 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 TestExceptionSerialization : ExceptionSerializationTestBase
+    {
+        public static IEnumerable<object> ExceptionTestData
+        {
+            get
+            {
+                var exceptionTypes = typeof(Lucene.Net.Search.Highlight.DefaultEncoder).Assembly.GetTypes().Where(t
=> typeof(Exception).IsAssignableFrom(t)).Cast<object>();
+
+                // If the assembly has no exceptions, just provide Exception so the test
will pass
+                if (!exceptionTypes.Any())
+                {
+                    return new Type[] { typeof(Exception) };
+                }
+
+                return exceptionTypes;
+            }
+        }
+
+        [Test, LuceneNetSpecific]
+        public void AllExceptionsInLuceneNamespaceCanSerialize([ValueSource("ExceptionTestData")]Type
luceneException)
+        {
+            var instance = TryInstantiate(luceneException);
+            Assert.That(TypeCanSerialize(instance), string.Format("Unable to serialize {0}",
luceneException.FullName));
+        }
+    }
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/Support/TestIcuBreakIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Icu/Support/TestIcuBreakIterator.cs b/src/Lucene.Net.Tests.Icu/Support/TestIcuBreakIterator.cs
new file mode 100644
index 0000000..2bc790c
--- /dev/null
+++ b/src/Lucene.Net.Tests.Icu/Support/TestIcuBreakIterator.cs
@@ -0,0 +1,421 @@
+#if FEATURE_BREAKITERATOR
+using Lucene.Net.Support;
+using Lucene.Net.Util;
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace Lucene.Net.Support
+{
+    /*
+	 * 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 TestIcuBreakIterator : LuceneTestCase
+    {
+        static readonly String TEXT =
+            "Apache Lucene(TM) is a high-performance, full-featured text search engine library
written entirely in Java.";
+
+        static readonly String SENTENCE_TEXT =
+            "Apache Lucene(TM) is a high-performance, full-featured text search engine library
written entirely in Java. " +
+            "It is a technology suitable for nearly any application that requires" +
+            "full-text search, especially cross-platform. Apache Lucene is an open source
project available for free download. " +
+            "Lucene makes finding things easy. Lucene is powerful. Lucene is exciting. Lucene
is cool. Where be Lucene now?";
+
+        private BreakIterator GetWordInstance(CultureInfo locale)
+        {
+            //return new WordBreakIterator(locale);
+            return new IcuBreakIterator(Icu.BreakIterator.UBreakIteratorType.WORD, locale)
{ EnableHacks = true };
+        }
+
+        private BreakIterator GetSentenceInstance(CultureInfo locale)
+        {
+            return new IcuBreakIterator(Icu.BreakIterator.UBreakIteratorType.SENTENCE, locale);
+        }
+
+        [Test]
+        public void TestWordIteration()
+        {
+            BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture);
+            bi.SetText(TEXT);
+
+            int temp;
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(7, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(7, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(13, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(13, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(14, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(16, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(17, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(17, temp);
+
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(16, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(16, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(17, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(17, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(18, temp);
+
+            temp = bi.Last();
+            Console.WriteLine(temp);
+            assertEquals(107, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(107, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(-1, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(107, temp);
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(106, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(106, temp);
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(102, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(102, temp);
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(101, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(101, temp);
+        }
+
+        [Test]
+        public void TestWordFollowing()
+        {
+            BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture);
+            bi.SetText(TEXT);
+
+            int temp;
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+
+
+            temp = bi.Following(70);
+            Console.WriteLine(temp);
+            assertEquals(73, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(73, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(74, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(74, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(81, temp);
+            temp = bi.Following(107); // Test the final boundary
+            Console.WriteLine(temp);
+            assertEquals(-1, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(-1, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(107, temp);
+
+            temp = bi.Following(66); // Test exactly on a boundary position
+            Console.WriteLine(temp);
+            assertEquals(67, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(73, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(73, temp);
+
+            temp = bi.Following(0); // Test the first boundary
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(7, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(7, temp);
+
+        }
+
+        [Test]
+        public void TestWordPreceding()
+        {
+            BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture);
+            bi.SetText(TEXT);
+
+            int temp;
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+
+
+            temp = bi.Preceding(70);
+            Console.WriteLine(temp);
+            assertEquals(67, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(67, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(73, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(73, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(74, temp);
+            temp = bi.Preceding(107); // Test the final boundary
+            Console.WriteLine(temp);
+            assertEquals(106, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(107, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(107, temp);
+
+            temp = bi.Preceding(66); // Test exactly on a boundary position
+            Console.WriteLine(temp);
+            assertEquals(60, temp);
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(59, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(59, temp);
+
+            temp = bi.Preceding(0); // Test the first boundary
+            Console.WriteLine(temp);
+            assertEquals(-1, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+
+        }
+
+        [Test]
+        public void TestWordNextWithInt()
+        {
+            BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture);
+            bi.SetText(TEXT);
+
+            int temp;
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(6, temp);
+
+
+            temp = bi.Next(10);
+            Console.WriteLine(temp);
+            assertEquals(23, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(23, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(39, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(39, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(40, temp);
+            temp = bi.Next(-8); // Test going backward
+            Console.WriteLine(temp);
+            assertEquals(16, temp); // Magically, this is correct (from position 28 back
8 places) in Java, even though its start position is wrong
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(17, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(17, temp);
+
+
+            temp = bi.Next(107); // Go past the last boundary
+            Console.WriteLine(temp);
+            assertEquals(-1, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(107, temp);
+            temp = bi.Next(-107); // Go past the first boundary
+            Console.WriteLine(temp);
+            assertEquals(-1, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+
+        }
+
+        [Test]
+        public void TestSentenceIteration()
+        {
+            BreakIterator bi = GetSentenceInstance(CultureInfo.InvariantCulture);
+            bi.SetText(SENTENCE_TEXT);
+
+            int temp;
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(108, temp);
+
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(108, temp);
+
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(221, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(221, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(290, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(290, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(324, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(344, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(364, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(364, temp);
+
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(344, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(344, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(364, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(364, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(380, temp);
+
+            temp = bi.First();
+            Console.WriteLine(temp);
+            assertEquals(0, temp);
+
+            temp = bi.Last();
+            Console.WriteLine(temp);
+            assertEquals(400, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(400, temp);
+            temp = bi.Next();
+            Console.WriteLine(temp);
+            assertEquals(-1, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(400, temp);
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(380, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(380, temp);
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(364, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(364, temp);
+            temp = bi.Previous();
+            Console.WriteLine(temp);
+            assertEquals(344, temp);
+            temp = bi.Current;
+            Console.WriteLine(temp);
+            assertEquals(344, temp);
+        }
+    }
+}
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/project.json
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Icu/project.json b/src/Lucene.Net.Tests.Icu/project.json
new file mode 100644
index 0000000..f9b0fe3
--- /dev/null
+++ b/src/Lucene.Net.Tests.Icu/project.json
@@ -0,0 +1,67 @@
+{
+  "version": "4.8.0",
+  "dependencies": {
+    "dotnet-test-nunit": "3.4.0-beta-3",
+    "Lucene.Net": "4.8.0",
+    "Lucene.Net.Analysis.Common": "4.8.0",
+    "Lucene.Net.Highlighter": "4.8.0",
+    "Lucene.Net.Icu": "4.8.0",
+    "Lucene.Net.TestFramework": "4.8.0",
+    "Lucene.Net.Tests.Analysis.Common": "4.8.0",
+    "NUnit": "3.5.0"
+  },
+  "buildOptions": {
+    "debugType": "portable",
+    "compile": {
+      "includeFiles": [
+        "../CommonAssemblyInfo.cs",
+        "../Lucene.Net.Tests.Analysis.Common/Analysis/Th/TestThaiAnalyzer.cs",
+        "../Lucene.Net.Tests.Analysis.Common/Analysis/Th/TestThaiTokenizerFactory.cs",
+        "../Lucene.Net.Tests.Analysis.Common/Analysis/Th/TestThaiWordFilterFactory.cs",
+        "../Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArrayIterator.cs",
+        "../Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestSegmentingTokenizerBase.cs",
+        "../Lucene.Net.Tests.Highlighter/PostingsHighlight/TestMultiTermHighlighting.cs",
+        "../Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs",
+        "../Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs",
+        "../Lucene.Net.Tests.Highlighter/PostingsHighlight/TestWholeBreakIterator.cs",
+        "../Lucene.Net.Tests.Highlighter/VectorHighlight/BreakIteratorBoundaryScannerTest.cs"
+      ]
+    },
+    "embed": {
+      "includeFiles": [
+        "Search/PostingsHighlight/CambridgeMA.utf8"
+      ]
+    }
+  },
+  "testRunner": "nunit",
+  "frameworks": {
+    "netcoreapp1.0": {
+      "imports": "dnxcore50",
+      "buildOptions": {
+        "define": [ "NETSTANDARD", "FEATURE_BREAKITERATOR" ],
+        "compile": {
+          "excludeFiles": [
+            "Support/TestApiConsistency.cs"
+          ]
+        }
+      },
+      "dependencies": {
+        "Microsoft.NETCore.App": {
+          "type": "platform",
+          "version": "1.0.1"
+        },
+        "System.Xml.XmlDocument": "4.0.1"
+      }
+    },
+    "net451": {
+      "buildOptions": {
+        "define": [ "FEATURE_BREAKITERATOR", "FEATURE_SERIALIZABLE" ]
+      }
+    }
+  },
+
+  "runtimes": {
+    "win7-x86": {},
+    "win7-x64": {}
+  }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj
index 1e3f970..69de9ee 100644
--- a/src/Lucene.Net/Lucene.Net.csproj
+++ b/src/Lucene.Net/Lucene.Net.csproj
@@ -599,7 +599,6 @@
     <Compile Include="Support\AtomicLong.cs" />
     <Compile Include="Support\AtomicObject.cs" />
     <Compile Include="Support\AtomicReferenceArray.cs" />
-    <Compile Include="Support\BreakIterator.cs" />
     <Compile Include="Support\Buffer.cs" />
     <Compile Include="Support\AttributeItem.cs" />
     <Compile Include="Support\BitArrayExtensions.cs" />
@@ -611,7 +610,6 @@
     <Compile Include="Support\C5.Support.cs" />
     <Compile Include="Support\Character.cs" />
     <Compile Include="Support\Arrays.cs" />
-    <Compile Include="Support\CharacterIterator.cs" />
     <Compile Include="Support\Codecs\CodecNameAttribute.cs" />
     <Compile Include="Support\Codecs\DefaultDocValuesFormatFactory.cs" />
     <Compile Include="Support\Codecs\DefaultPostingsFormatFactory.cs" />
@@ -668,7 +666,6 @@
     <Compile Include="Support\SignedZeroComparer.cs" />
     <Compile Include="Support\StreamUtils.cs" />
     <Compile Include="Support\StringBuilderExtensions.cs" />
-    <Compile Include="Support\StringCharacterIterator.cs" />
     <Compile Include="Support\StringCharSequenceWrapper.cs" />
     <Compile Include="Support\StringExtensions.cs" />
     <Compile Include="Support\StringTokenizer.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Properties/AssemblyInfo.cs b/src/Lucene.Net/Properties/AssemblyInfo.cs
index b558f6a..2acfe37 100644
--- a/src/Lucene.Net/Properties/AssemblyInfo.cs
+++ b/src/Lucene.Net/Properties/AssemblyInfo.cs
@@ -55,10 +55,12 @@ using System.Runtime.CompilerServices;
 [assembly: InternalsVisibleTo("Lucene.Net.Tests")]
 [assembly: InternalsVisibleTo("Lucene.Net.TestFramework")]
 [assembly: InternalsVisibleTo("Lucene.Net.Highlighter")] // For Automaton
+[assembly: InternalsVisibleTo("Lucene.Net.Icu")] // For Automaton
 [assembly: InternalsVisibleTo("Lucene.Net.Misc")]
 [assembly: InternalsVisibleTo("Lucene.Net.Suggest")] // For Automaton
 [assembly: InternalsVisibleTo("Lucene.Net.Tests.Analysis.Common")] // For Automaton
 [assembly: InternalsVisibleTo("Lucene.Net.Tests.Highlighter")] // For Automaton
+[assembly: InternalsVisibleTo("Lucene.Net.Tests.Icu")] // For Analysis.Util.TestSegmentingTokenizerBase
 [assembly: InternalsVisibleTo("Lucene.Net.Tests.Misc")]
 [assembly: InternalsVisibleTo("Lucene.Net.Tests.QueryParser")]
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net/Support/BreakIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Support/BreakIterator.cs b/src/Lucene.Net/Support/BreakIterator.cs
deleted file mode 100644
index ded1c9c..0000000
--- a/src/Lucene.Net/Support/BreakIterator.cs
+++ /dev/null
@@ -1,231 +0,0 @@
-#if FEATURE_BREAKITERATOR
-using System;
-
-namespace Lucene.Net.Support
-{
-    /// <summary>
-    /// The <code>BreakIterator</code> class implements methods for finding
-    /// the location of boundaries in text. Instances of <code>BreakIterator</code>
-    /// maintain a current position and scan over text
-    /// returning the index of characters where boundaries occur.
-    /// </summary>
-    public abstract class BreakIterator
-#if FEATURE_CLONEABLE
-        : ICloneable
-#endif
-    {
-        /// <summary>
-        /// Constructor. BreakIterator is stateless and has no default behavior.
-        /// </summary>
-        protected BreakIterator()
-        {
-        }
-
-        /// <summary>
-        /// Create a copy of this iterator
-        /// </summary>
-        /// <returns>A member-wise copy of this</returns>
-        public object Clone()
-        {
-            return MemberwiseClone();
-        }
-
-        /// <summary>
-        /// DONE is returned by Previous(), Next(), Next(int), Preceding(int)
-        /// and Following(int) when either the first or last text boundary has been
-        /// reached.
-        /// </summary>
-        public static readonly int DONE = -1;
-
-        /// <summary>
-        /// Returns the first boundary. The iterator's current position is set
-        /// to the first text boundary.
-        /// </summary>
-        /// <returns>The character index of the first text boundary</returns>
-        public abstract int First();
-
-        /// <summary>
-        /// Returns the last boundary. The iterator's current position is set
-        /// to the last text boundary.
-        /// </summary>
-        /// <returns>The character index of the last text boundary.</returns>
-        public abstract int Last();
-
-        /// <summary>
-        /// Returns the nth boundary from the current boundary. If either
-        /// the first or last text boundary has been reached, it returns
-        /// <see cref="BreakIterator.DONE"/> and the current position is set to either
-        /// the first or last text boundary depending on which one is reached. Otherwise,
-        /// the iterator's current position is set to the new boundary.
-        /// For example, if the iterator's current position is the mth text boundary
-        /// and three more boundaries exist from the current boundary to the last text
-        /// boundary, the Next(2) call will return m + 2. The new text position is set
-        /// to the (m + 2)th text boundary. A Next(4) call would return
-        /// <see cref="BreakIterator.DONE"/> and the last text boundary would become
the
-        /// new text position.
-        /// </summary>
-        /// <param name="n">
-        /// which boundary to return.  A value of 0
-        /// does nothing.  Negative values move to previous boundaries
-        /// and positive values move to later boundaries.
-        /// </param>
-        /// <returns>
-        /// The character index of the nth boundary from the current position
-        /// or <see cref="BreakIterator.DONE"/> if either first or last text boundary
-        /// has been reached.
-        /// </returns>
-        public abstract int Next(int n);
-
-        /// <summary>
-        /// Returns the boundary following the current boundary. If the current boundary
-        /// is the last text boundary, it returns <c>BreakIterator.DONE</c> and
-        /// the iterator's current position is unchanged. Otherwise, the iterator's
-        /// current position is set to the boundary following the current boundary.
-        /// </summary>
-        /// <returns>
-        /// The character index of the next text boundary or
-        /// <see cref="BreakIterator.DONE"/> if the current boundary is the last text
-        /// boundary.
-        /// Equivalent to Next(1).
-        /// </returns>
-        /// <seealso cref="Next(int)"/>
-        public abstract int Next();
-
-        /// <summary>
-        /// Returns the boundary preceding the current boundary. If the current boundary
-        /// is the first text boundary, it returns <code>BreakIterator.DONE</code>
and
-        /// the iterator's current position is unchanged. Otherwise, the iterator's
-        /// current position is set to the boundary preceding the current boundary.
-        /// </summary>
-        /// <returns>
-        /// The character index of the previous text boundary or
-        /// <see cref="BreakIterator.DONE"/> if the current boundary is the first text
-        /// boundary.
-        /// </returns>
-        public abstract int Previous();
-
-        /// <summary>
-        /// Returns the first boundary following the specified character offset. If the
-        /// specified offset equals to the last text boundary, it returns
-        /// <see cref="BreakIterator.DONE"/> and the iterator's current position is
unchanged.
-        /// Otherwise, the iterator's current position is set to the returned boundary.
-        /// The value returned is always greater than the offset or the value
-        /// <see cref="BreakIterator.DONE"/>.
-        /// </summary>
-        /// <param name="offset">the character offset to begin scanning.</param>
-        /// <returns>
-        /// The first boundary after the specified offset or
-        /// <see cref="BreakIterator.DONE"/> if the last text boundary is passed in
-        /// as the offset.
-        /// </returns>
-        /// <exception cref="ArgumentException">
-        /// if the specified offset is less than
-        /// the first text boundary or greater than the last text boundary.
-        /// </exception>
-        public abstract int Following(int offset);
-
-        /// <summary>
-        /// Returns the last boundary preceding the specified character offset. If the
-        /// specified offset equals to the first text boundary, it returns
-        /// <see cref="BreakIterator.DONE"/> and the iterator's current position is
unchanged.
-        /// Otherwise, the iterator's current position is set to the returned boundary.
-        /// The value returned is always less than the offset or the value
-        /// <see cref="BreakIterator.DONE"/>.
-        /// </summary>
-        /// <param name="offset">the character offset to begin scanning.</param>
-        /// <returns>
-        /// The last boundary before the specified offset or
-        /// <see cref="BreakIterator.DONE"/> if the first text boundary is passed in
-        /// as the offset.
-        /// </returns>
-        public abstract int Preceding(int offset);
-        //{
-        //    // NOTE:  This implementation is here solely because we can't add new
-        //    // abstract methods to an existing class.  There is almost ALWAYS a
-        //    // better, faster way to do this.
-        //    int pos = Following(offset);
-        //    while (pos >= offset && pos != DONE)
-        //    {
-        //        pos = Previous();
-        //    }
-        //    return pos;
-        //}
-
-        /// <summary>
-        /// Returns true if the specified character offset is a text boundary.
-        /// </summary>
-        /// <param name="offset">the character offset to check.</param>
-        /// <returns><c>true</c> if "offset" is a boundary position, <c>false</c>
otherwise.</returns>
-        /// <exception cref="ArgumentException">
-        /// if the specified offset is less than
-        /// the first text boundary or greater than the last text boundary.
-        /// </exception>
-        public abstract bool IsBoundary(int offset);
-        //{
-        //    // NOTE: This implementation probably is wrong for most situations
-        //    // because it fails to take into account the possibility that a
-        //    // CharacterIterator passed to setText() may not have a begin offset
-        //    // of 0.  But since the abstract BreakIterator doesn't have that
-        //    // knowledge, it assumes the begin offset is 0.  If you subclass
-        //    // BreakIterator, copy the SimpleTextBoundary implementation of this
-        //    // function into your subclass.  [This should have been abstract at
-        //    // this level, but it's too late to fix that now.]
-        //    if (offset == 0)
-        //    {
-        //        return true;
-        //    }
-        //    int boundary = Following(offset - 1);
-        //    if (boundary == DONE)
-        //    {
-        //        throw new ArgumentException();
-        //    }
-        //    return boundary == offset;
-        //}
-
-        /// <summary>
-        /// Returns character index of the text boundary that was most
-        /// recently returned by Next(), Next(int), Previous(), First(), Last(),
-        /// Following(int) or Preceding(int). If any of these methods returns
-        /// <see cref="BreakIterator.DONE"/> because either first or last text boundary
-        /// has been reached, it returns the first or last text boundary depending on
-        /// which one is reached.
-        /// </summary>
-        /// <returns>
-        /// The text boundary returned from the above methods, first or last
-        /// text boundary.
-        /// </returns>
-        /// <seealso cref="Next()"/>
-        /// <seealso cref="Next(int)"/>
-        /// <seealso cref="Previous()"/>
-        /// <seealso cref="First()"/>
-        /// <seealso cref="Last()"/>
-        /// <seealso cref="Following(int)"/>
-        /// <seealso cref="Preceding(int)"/>
-        public abstract int Current { get; }
-
-        /// <summary>
-        /// Get the text being scanned
-        /// </summary>
-        /// <returns>the text being scanned</returns>
-        //public abstract CharacterIterator GetText();
-        public abstract string Text { get; }
-
-        /// <summary>
-        /// Set a new text string to be scanned.  The current scan
-        /// position is reset to First().
-        /// </summary>
-        /// <param name="newText">new text to scan.</param>
-        public virtual void SetText(string newText)
-        {
-            SetText(new StringCharacterIterator(newText));
-        }
-
-        /// <summary>
-        /// Set a new text string to be scanned.  The current scan
-        /// position is reset to First().
-        /// </summary>
-        /// <param name="newText">new text to scan.</param>
-        public abstract void SetText(CharacterIterator newText);
-    }
-}
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net/Support/CharacterIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Support/CharacterIterator.cs b/src/Lucene.Net/Support/CharacterIterator.cs
deleted file mode 100644
index 0c81629..0000000
--- a/src/Lucene.Net/Support/CharacterIterator.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-#if FEATURE_BREAKITERATOR
-using System;
-
-namespace Lucene.Net.Support
-{
-    /*
-     * 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 abstract class CharacterIterator
-    {
-        public static readonly char DONE = '\uFFFF';
-
-        public abstract char Current { get; }
-
-        public abstract char First();
-
-        public abstract char Last();
-
-        public abstract char Next();
-
-        public abstract char Previous();
-
-        public abstract char SetIndex(int position);
-
-        public abstract int BeginIndex { get; }
-
-        public abstract int EndIndex { get; }
-
-        public abstract int Index { get; }
-
-        public abstract object Clone();
-
-        public abstract string GetTextAsString();
-    }
-}
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net/Support/StringCharacterIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Support/StringCharacterIterator.cs b/src/Lucene.Net/Support/StringCharacterIterator.cs
deleted file mode 100644
index a91e49a..0000000
--- a/src/Lucene.Net/Support/StringCharacterIterator.cs
+++ /dev/null
@@ -1,232 +0,0 @@
-#if FEATURE_BREAKITERATOR
-/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
- * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
- *
- * The original version of this source code and documentation
- * is copyrighted and owned by Taligent, Inc., a wholly-owned
- * subsidiary of IBM. These materials are provided under terms
- * of a License Agreement between Taligent and Sun. This technology
- * is protected by multiple US and International patents.
- *
- * This notice and attribution to Taligent may not be removed.
- * Taligent is a registered trademark of Taligent, Inc.
- *
- */
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Lucene.Net.Support
-{
-    /// <summary>
-    /// <see cref="StringCharacterIterator"/> implements the
-    /// <see cref="CharacterIterator"/> protocol for a <see cref="string"/>.
-    /// The <see cref="StringCharacterIterator"/> class iterates over the
-    /// entire <see cref="string"/>.
-    /// </summary>
-    /// <seealso cref="CharacterIterator"/>
-    public class StringCharacterIterator : CharacterIterator
-    {
-        private string text;
-        private int begin;
-        private int end;
-        // invariant: begin <= pos <= end
-        private int pos;
-
-
-        public StringCharacterIterator(string text)
-            : this(text, 0)
-        {
-        }
-
-        public StringCharacterIterator(string text, int pos)
-            : this(text, 0, text.Length, pos)
-        {
-        }
-
-        public StringCharacterIterator(string text, int begin, int end, int pos)
-        {
-            if (text == null)
-                throw new ArgumentNullException("text");
-            this.text = text;
-
-            if (begin < 0 || begin > end || end > text.Length)
-                throw new ArgumentException("Invalid substring range");
-
-            if (pos < begin || pos > end)
-                throw new ArgumentException("Invalid position");
-
-            this.begin = begin;
-            this.end = end;
-            this.pos = pos;
-        }
-
-        public void SetText(string text)
-        {
-            if (text == null)
-                throw new ArgumentNullException("text");
-            this.text = text;
-            this.begin = 0;
-            this.end = text.Length;
-            this.pos = 0;
-        }
-
-        public override char First()
-        {
-            pos = begin;
-            return Current;
-        }
-
-        public override char Last()
-        {
-            if (end != begin)
-            {
-                pos = end - 1;
-            }
-            else
-            {
-                pos = end;
-            }
-            return Current;
-        }
-
-        public override char SetIndex(int position)
-        {
-            if (position < begin || position > end)
-                throw new ArgumentException("Invalid index");
-            pos = position;
-            return Current;
-        }
-
-        public override char Current
-        {
-            get
-            {
-                if (pos >= begin && pos < end)
-                {
-                    return text[pos];
-                }
-                else
-                {
-                    return DONE;
-                }
-            }
-        }
-
-        public override char Next()
-        {
-            if (pos < end - 1)
-            {
-                pos++;
-                return text[pos];
-            }
-            else
-            {
-                pos = end;
-                return DONE;
-            }
-        }
-
-        public override char Previous()
-        {
-            if (pos > begin)
-            {
-                pos--;
-                return text[pos];
-            }
-            else
-            {
-                return DONE;
-            }
-        }
-
-
-        public override int BeginIndex
-        {
-            get
-            {
-                return begin;
-            }
-        }
-
-        public override int EndIndex
-        {
-            get
-            {
-                return end;
-            }
-        }
-
-        public override int Index
-        {
-            get
-            {
-                return pos;
-            }
-        }
-
-        public override string GetTextAsString()
-        {
-            return text;
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (this == obj)
-                return true;
-            if (!(obj is StringCharacterIterator))
-            return false;
-
-            StringCharacterIterator that = (StringCharacterIterator)obj;
-
-            if (GetHashCode() != that.GetHashCode())
-                return false;
-            if (!text.Equals(that.text, StringComparison.Ordinal))
-                return false;
-            if (pos != that.pos || begin != that.begin || end != that.end)
-                return false;
-            return true;
-        }
-
-        public override int GetHashCode()
-        {
-            return base.GetHashCode() ^ pos ^ begin ^ end;
-        }
-
-        public override object Clone()
-        {
-            return MemberwiseClone();
-        }
-    }
-}
-#endif


Mime
View raw message