lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [21/23] lucenenet git commit: Lucene.Net.TestFramework.Util.LuceneTestCase: Moved CleanupTemporaryFiles() call from TearDown() method to AfterClass() method, which makes it act more like the original setup. Test2BDocs, TestBackwardsCompatibility, and Tes
Date Sun, 19 Mar 2017 23:20:16 GMT
Lucene.Net.TestFramework.Util.LuceneTestCase: Moved CleanupTemporaryFiles() call from TearDown()
method to AfterClass() method, which makes it act more like the original setup. Test2BDocs,
TestBackwardsCompatibility, and TestBackwardsCompatibility3x depend on using the same index
for multiple tests, so hacks in these files were removed. Also changed calling order for base.TearDown()
so it is last in all tests (after cleaning up local resources).


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

Branch: refs/heads/api-work
Commit: b2a557335d22effb751f6b6b41b68decf98af3ad
Parents: 6ffeb41
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Mar 20 04:16:52 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Mar 20 04:16:52 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs          | 3 ++-
 .../ClassificationTestBase.cs                                | 4 ++--
 src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs   | 2 +-
 src/Lucene.Net.Tests.Queries/Function/TestBoostedQuery.cs    | 2 +-
 .../Function/TestLongNormValueSource.cs                      | 3 +--
 src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs    | 3 +--
 src/Lucene.Net.Tests/Index/Test2BDocs.cs                     | 8 --------
 src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs     | 8 --------
 src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs   | 8 --------
 src/Lucene.Net.Tests/Index/TestIsCurrent.cs                  | 2 +-
 src/Lucene.Net.Tests/Search/TestIndexSearcher.cs             | 2 +-
 11 files changed, 10 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/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 b10c728..878168a 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -623,7 +623,7 @@ namespace Lucene.Net.Util
             /* LUCENENET TODO: Not sure how to convert these
                 ParentChainCallRule.TeardownCalled = true;
                 */
-            CleanupTemporaryFiles(); // LUCENENET TODO: Move this to OneTimeTearDown()? Calling
it here deletes shared files too early.
+            //CleanupTemporaryFiles(); // LUCENENET TODO: Move this to OneTimeTearDown()?
Calling it here deletes shared files too early.
         }
 
         // LUCENENET specific constants to scan the test framework for codecs/docvaluesformats/postingsformats
only once
@@ -650,6 +650,7 @@ namespace Lucene.Net.Util
         public virtual void AfterClass()
         {
             ClassEnvRule.After(this);
+            CleanupTemporaryFiles();
         }
 
         // -----------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests.Classification/ClassificationTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Classification/ClassificationTestBase.cs b/src/Lucene.Net.Tests.Classification/ClassificationTestBase.cs
index 3ab492c..6fb483d 100644
--- a/src/Lucene.Net.Tests.Classification/ClassificationTestBase.cs
+++ b/src/Lucene.Net.Tests.Classification/ClassificationTestBase.cs
@@ -68,11 +68,11 @@ namespace Lucene.Net.Classification
         }
 
         [TearDown]
-        public void tearDown()
+        public override void TearDown()
         {
-            base.TearDown();
             indexWriter.Dispose();
             dir.Dispose();
+            base.TearDown();
         }
 
         protected void CheckCorrectClassification(IClassifier<T> classifier, String
inputDoc, T expectedResult, Analyzer analyzer, String textFieldName, String classFieldName)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs b/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs
index f1598fc..9725fc5 100644
--- a/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs
@@ -62,10 +62,10 @@ namespace Lucene.Net.Tests.Queries.Function
         [TearDown]
         public override void TearDown()
         {
-            base.TearDown();
             dir.Dispose();
             dir = null;
             anlzr = null;
+            base.TearDown();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests.Queries/Function/TestBoostedQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestBoostedQuery.cs b/src/Lucene.Net.Tests.Queries/Function/TestBoostedQuery.cs
index 6bd4958..e12c7f5 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestBoostedQuery.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestBoostedQuery.cs
@@ -41,12 +41,12 @@ namespace Lucene.Net.Tests.Queries.Function
         [TearDown]
         public override void TearDown()
         {
-            base.TearDown();
             @is = null;
             ir.Dispose();
             ir = null;
             dir.Dispose();
             dir = null;
+            base.TearDown();
         }
         
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs b/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
index 95e63d3..96341aa 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestLongNormValueSource.cs
@@ -48,13 +48,12 @@ namespace Lucene.Net.Tests.Queries.Function
         [TearDown]
         public override void TearDown()
         {
-            base.TearDown();
-
             searcher = null;
             reader.Dispose();
             reader = null;
             dir.Dispose();
             dir = null;
+            base.TearDown();
         }
         
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs b/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs
index 2ca9f0d..509ec25 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs
@@ -83,13 +83,12 @@ namespace Lucene.Net.Tests.Queries.Function
         [TearDown]
         public override void TearDown()
         {
-            base.TearDown();
-
             searcher = null;
             reader.Dispose();
             reader = null;
             dir.Dispose();
             dir = null;
+            base.TearDown();
         }
         
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests/Index/Test2BDocs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/Test2BDocs.cs b/src/Lucene.Net.Tests/Index/Test2BDocs.cs
index f7ce0f7..a1d3c4e 100644
--- a/src/Lucene.Net.Tests/Index/Test2BDocs.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BDocs.cs
@@ -50,17 +50,9 @@ namespace Lucene.Net.Index
         {
             Dir.Dispose();
             Dir = null;
-            base.TearDown();
             base.AfterClass();
         }
 
-        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
-        {
-            // LUCENENET: We don't want our temp directory deleted until after
-            // all of the tests in the class run. So we need to override this and
-            // call base.TearDown() manually during TestFixtureTearDown
-        }
-
         [Test]
         public virtual void TestOverflow()
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/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 cb78dec..d4602e0 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
@@ -229,17 +229,9 @@ namespace Lucene.Net.Index
                 d.Dispose();
             }
             OldIndexDirs = null;
-            base.TearDown();
             base.AfterClass();
         }
 
-        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
-        {
-            // LUCENENET: We don't want our temp directory deleted until after
-            // all of the tests in the class run. So we need to override this and
-            // call base.TearDown() manually during TestFixtureTearDown
-        }
-
         /// <summary>
         /// this test checks that *only* IndexFormatTooOldExceptions are thrown when you
open and operate on too old indexes! </summary>
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/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 3e71b3a..3dd44a9 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
@@ -158,17 +158,9 @@ namespace Lucene.Net.Index
                 d.Dispose();
             }
             OldIndexDirs = null;
-            base.TearDown();
             base.AfterClass();
         }
 
-        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
-        {
-            // LUCENENET: We don't want our temp directory deleted until after
-            // all of the tests in the class run. So we need to override this and
-            // call base.TearDown() manually during TestFixtureTearDown
-        }
-
         /// <summary>
         /// this test checks that *only* IndexFormatTooOldExceptions are thrown when you
open and operate on too old indexes! </summary>
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests/Index/TestIsCurrent.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIsCurrent.cs b/src/Lucene.Net.Tests/Index/TestIsCurrent.cs
index d975080..99dfaca 100644
--- a/src/Lucene.Net.Tests/Index/TestIsCurrent.cs
+++ b/src/Lucene.Net.Tests/Index/TestIsCurrent.cs
@@ -52,9 +52,9 @@ namespace Lucene.Net.Index
         [TearDown]
         public override void TearDown()
         {
-            base.TearDown();
             Writer.Dispose();
             Directory.Dispose();
+            base.TearDown();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b2a55733/src/Lucene.Net.Tests/Search/TestIndexSearcher.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestIndexSearcher.cs b/src/Lucene.Net.Tests/Search/TestIndexSearcher.cs
index d5dce40..d3344d2 100644
--- a/src/Lucene.Net.Tests/Search/TestIndexSearcher.cs
+++ b/src/Lucene.Net.Tests/Search/TestIndexSearcher.cs
@@ -60,9 +60,9 @@ namespace Lucene.Net.Search
         [TearDown]
         public override void TearDown()
         {
-            base.TearDown();
             Reader.Dispose();
             Dir.Dispose();
+            base.TearDown();
         }
 
         // should not throw exception


Mime
View raw message