Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EA617200C54 for ; Thu, 2 Mar 2017 02:10:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E931F160B78; Thu, 2 Mar 2017 01:10:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7C5A6160B70 for ; Thu, 2 Mar 2017 02:10:46 +0100 (CET) Received: (qmail 77547 invoked by uid 500); 2 Mar 2017 01:10:45 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 76388 invoked by uid 99); 2 Mar 2017 01:10:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2017 01:10:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A086BF320D; Thu, 2 Mar 2017 01:10:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Thu, 02 Mar 2017 01:11:09 -0000 Message-Id: <708c044de54641d1a5bb9b6c90338a1c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [26/27] lucenenet git commit: Lucene.Net.Tests.project.json: Added missing tests for .NET Core (Index.TestBackwardCompatibility + Index.TestBackwardCompatibility3x + Index.TestFlushByRamOrCountsPolicy + Search.TestFieldCache + Util.TestMathUtil). Deleted archived-at: Thu, 02 Mar 2017 01:10:48 -0000 Lucene.Net.Tests.project.json: Added missing tests for .NET Core (Index.TestBackwardCompatibility + Index.TestBackwardCompatibility3x + Index.TestFlushByRamOrCountsPolicy + Search.TestFieldCache + Util.TestMathUtil). Deleted unused Cache.TestSimpleLRUCache test (doesn't exist in Lucene, and no corresponding class to test). Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/38e696cf Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/38e696cf Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/38e696cf Branch: refs/heads/api-work Commit: 38e696cfb1156cb83c2b40da68ed725ddd210d6f Parents: 8c97a24 Author: Shad Storhaug Authored: Thu Mar 2 05:06:03 2017 +0700 Committer: Shad Storhaug Committed: Thu Mar 2 08:09:07 2017 +0700 ---------------------------------------------------------------------- .../Index/TestBackwardsCompatibility.cs | 9 ++- .../Index/TestBackwardsCompatibility3x.cs | 9 ++- .../Util/Cache/TestSimpleLRUCache.cs | 77 -------------------- src/Lucene.Net.Tests/project.json | 6 -- 4 files changed, 10 insertions(+), 91 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/38e696cf/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs index c815c91..16fdd5f 100644 --- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs +++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Reflection; using System.Text; namespace Lucene.Net.Index @@ -212,7 +213,7 @@ namespace Lucene.Net.Index foreach (string name in names) { DirectoryInfo dir = CreateTempDir(name); - using (Stream zipFileStream = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "index." + name + ".zip")) + using (Stream zipFileStream = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "index." + name + ".zip")) { TestUtil.Unzip(zipFileStream, dir); } @@ -251,7 +252,7 @@ namespace Lucene.Net.Index Console.WriteLine("TEST: index " + UnsupportedNames[i]); } DirectoryInfo oldIndxeDir = CreateTempDir(UnsupportedNames[i]); - using (Stream dataFile = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "unsupported." + UnsupportedNames[i] + ".zip")) + using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "unsupported." + UnsupportedNames[i] + ".zip")) { TestUtil.Unzip(dataFile, oldIndxeDir); } @@ -960,7 +961,7 @@ namespace Lucene.Net.Index foreach (string name in OldIndexDirs.Keys) { DirectoryInfo dir = CreateTempDir(name); - using (Stream dataFile = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "index." + name + ".zip")) + using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "index." + name + ".zip")) { TestUtil.Unzip(dataFile, dir); } @@ -1068,7 +1069,7 @@ namespace Lucene.Net.Index public virtual void TestMoreTerms() { DirectoryInfo oldIndexDir = CreateTempDir("moreterms"); - using (Stream dataFile = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + MoreTermsIndex)) + using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + MoreTermsIndex)) { TestUtil.Unzip(dataFile, oldIndexDir); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/38e696cf/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs index 8b437ac..fffab02 100644 --- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs +++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Reflection; using System.Text; namespace Lucene.Net.Index @@ -141,7 +142,7 @@ namespace Lucene.Net.Index foreach (string name in names) { DirectoryInfo dir = CreateTempDir(name); - using (Stream zipFileStream = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "index." + name + ".zip")) + using (Stream zipFileStream = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "index." + name + ".zip")) { TestUtil.Unzip(zipFileStream, dir); } @@ -180,7 +181,7 @@ namespace Lucene.Net.Index Console.WriteLine("TEST: index " + UnsupportedNames[i]); } DirectoryInfo oldIndexDir = CreateTempDir(UnsupportedNames[i]); - using (Stream dataFile = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "unsupported." + UnsupportedNames[i] + ".zip")) + using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + "unsupported." + UnsupportedNames[i] + ".zip")) { TestUtil.Unzip(dataFile, oldIndexDir); } @@ -967,7 +968,7 @@ namespace Lucene.Net.Index public virtual void TestSurrogates() { DirectoryInfo oldIndexDir = CreateTempDir("surrogates"); - using (Stream dataFile = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + SurrogatesIndexName)) + using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + SurrogatesIndexName)) { TestUtil.Unzip(dataFile, oldIndexDir); } @@ -1029,7 +1030,7 @@ namespace Lucene.Net.Index public virtual void TestNegativePositions() { DirectoryInfo oldIndexDir = CreateTempDir("negatives"); - using (Stream dataFile = this.GetType().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + Bogus24IndexName)) + using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(CURRENT_RESOURCE_DIRECTORY + Bogus24IndexName)) { TestUtil.Unzip(dataFile, oldIndexDir); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/38e696cf/src/Lucene.Net.Tests/Util/Cache/TestSimpleLRUCache.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Util/Cache/TestSimpleLRUCache.cs b/src/Lucene.Net.Tests/Util/Cache/TestSimpleLRUCache.cs deleted file mode 100644 index 6b765e0..0000000 --- a/src/Lucene.Net.Tests/Util/Cache/TestSimpleLRUCache.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; - -using NUnit.Framework; - -using LuceneTestCase = Lucene.Net.Util.LuceneTestCase; - -namespace Lucene.Net.Util.Cache -{ - - [TestFixture] - public class TestSimpleLRUCache : LuceneTestCase - { - - [Test] - public virtual void TestLRUCache() - { - int n = 100; - object dummy = new object(); - - Cache cache = new SimpleLRUCache(n); - - for (int i = 0; i < n; i++) - { - cache.Put(i, dummy); - } - - // access every 2nd item in cache - for (int i = 0; i < n; i += 2) - { - Assert.IsNotNull(cache.Get(i)); - } - - // add n/2 elements to cache, the ones that weren't - // touched in the previous loop should now be thrown away - for (int i = n; i < n + (n / 2); i++) - { - cache.Put(i, dummy); - } - - // access every 4th item in cache - for (int i = 0; i < n; i += 4) - { - Assert.IsNotNull(cache.Get(i)); - } - - // add 3/4n elements to cache, the ones that weren't - // touched in the previous loops should now be thrown away - for (int i = n; i < n + (n * 3 / 4); i++) - { - cache.Put(i, dummy); - } - - // access every 4th item in cache - for (int i = 0; i < n; i += 4) - { - Assert.IsNotNull(cache.Get(i)); - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/38e696cf/src/Lucene.Net.Tests/project.json ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/project.json b/src/Lucene.Net.Tests/project.json index b4fbc30..82d1117 100644 --- a/src/Lucene.Net.Tests/project.json +++ b/src/Lucene.Net.Tests/project.json @@ -12,19 +12,14 @@ "define": [ "NETSTANDARD", "FEATURE_TASKMERGESCHEDULER" ], "compile": { "exclude": [ - "Util/Cache", "Util/JunitCompat" ], "excludeFiles": [ "TestApiConsistency.cs", "TestMergeSchedulerExternal.cs", "TestWorstCaseTestBehavior.cs", - "Index/TestBackwardsCompatibility.cs", - "Index/TestBackwardsCompatibility3x.cs", "Index/TestConcurrentMergeScheduler.cs", - "Index/TestFlushByRamOrCountsPolicy.cs", "Search/TestControlledRealTimeReopenThread.cs", - "Search/TestFieldCache.cs", "Support/BigObject.cs", "Support/CollisionTester.cs", "Support/SmallObject.cs", @@ -42,7 +37,6 @@ "Support/TestWeakDictionary.cs", "Support/TestWeakDictionaryBehavior.cs", "Support/TestWeakDictionaryPerformance.cs", - "Util/TestMathUtil.cs", "Util/TestMaxFailuresRule.cs" ] },