lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: Fixing test failures relating to folders existence checks
Date Sat, 02 May 2015 19:49:58 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 7a1f331a1 -> df753f9c8


Fixing test failures relating to folders existence checks


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

Branch: refs/heads/master
Commit: df753f9c8729fe1bbad9c2245d68efd7813778ab
Parents: 7a1f331
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sat May 2 22:49:39 2015 +0300
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sat May 2 22:49:39 2015 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Core/Store/FileSwitchDirectory.cs |  2 +-
 src/Lucene.Net.Tests/core/Store/TestDirectory.cs |  6 ++++--
 .../core/Store/TestFileSwitchDirectory.cs        | 19 ++++++++++---------
 3 files changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/df753f9c/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs b/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
index 0e4468f..362bf5c 100644
--- a/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
+++ b/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
@@ -112,7 +112,7 @@ namespace Lucene.Net.Store
                     files.Add(f);
                 }
             }
-            catch (NoSuchDirectoryException e)
+            catch (NoSuchDirectoryException)
             {
                 // we got NoSuchDirectoryException from both dirs
                 // rethrow the first.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/df753f9c/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
index 995f9fd..5d4f01e 100644
--- a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Attributes;
 using Lucene.Net.Randomized.Generators;
 using Lucene.Net.Support;
+using Lucene.Net.Util;
 using NUnit.Framework;
 using System;
 using System.IO;
@@ -258,7 +259,8 @@ namespace Lucene.Net.Store
         [Test]
         public virtual void TestDontCreate()
         {
-            var path = new DirectoryInfo(Path.Combine(AppSettings.Get("tmpDir", ""), "doesnotexist"));
+            var parentFolder = CreateTempDir(this.GetType().Name.ToLowerInvariant());
+            var path = new DirectoryInfo(Path.Combine(parentFolder.FullName, "doesnotexist"));
             try
             {
                 Assert.IsTrue(!path.Exists);
@@ -268,7 +270,7 @@ namespace Lucene.Net.Store
             }
             finally
             {
-                System.IO.Directory.Delete(path.FullName, true);
+                if (path.Exists) System.IO.Directory.Delete(path.FullName, true);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/df753f9c/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
index 6cfa6f0..8228e10 100644
--- a/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
@@ -113,17 +113,18 @@ namespace Lucene.Net.Store
             DirectoryInfo secondDir = CreateTempDir("bar");
             System.IO.Directory.Delete(primDir.FullName, true);
             System.IO.Directory.Delete(secondDir.FullName, true);
-            Directory dir = NewFSSwitchDirectory(primDir, secondDir, new HashSet<string>());
-            try
-            {
-                DirectoryReader.Open(dir);
-                Assert.Fail("did not hit expected exception");
-            }
-            catch (IndexNotFoundException nsde)
+            using (Directory dir = NewFSSwitchDirectory(primDir, secondDir, new HashSet<string>()))
             {
-                // expected
+                try
+                {
+                    DirectoryReader.Open(dir);
+                    Assert.Fail("did not hit expected exception");
+                }
+                catch (NoSuchDirectoryException)
+                {
+                    // expected
+                }
             }
-            dir.Dispose();
         }
 
         // LUCENE-3380 test that we can add a file, and then when we call list() we get it
back


Mime
View raw message