lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [04/18] lucenenet git commit: Strengthening tests and adding TODO
Date Tue, 06 Jan 2015 03:46:20 GMT
Strengthening tests and adding TODO


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

Branch: refs/heads/master
Commit: 45600538e109ee8b136ce50843b2c87ef7c5def1
Parents: 26de7b8
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Mon Jan 5 16:00:08 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Mon Jan 5 16:00:08 2015 +0200

----------------------------------------------------------------------
 .../core/Store/TestNRTCachingDirectory.cs       | 32 +++++++++-----------
 1 file changed, 15 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45600538/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
index 6d34509..177bd44 100644
--- a/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
@@ -138,28 +138,26 @@ namespace Lucene.Net.Store
         }
 
         // LUCENE-3382 -- make sure we get exception if the directory really does not exist.
-        [Test]
+        [Test, Timeout(int.MaxValue)]
         public virtual void TestNoDir()
         {
-            //Directory tempDir = CreateTempDir("doesnotexist");
-
-            string tempDir = Path.GetTempPath();
-            if (tempDir == null)
-                throw new IOException("java.io.tmpdir undefined, cannot run test");
-            DirectoryInfo TempDir = new DirectoryInfo(Path.Combine(tempDir, "RAMDirIndex"));
+            // LUCENENET TODO mysterious failure - FSDirectory recreates the folder by design,
not sure why this passes for Java Lucene
 
-            System.IO.Directory.Delete(TempDir.FullName, true);
-            Directory dir = new NRTCachingDirectory(NewFSDirectory(TempDir), 2.0, 25.0);
-            try
-            {
-                DirectoryReader.Open(dir);
-                Assert.Fail("did not hit expected exception");
-            }
-            catch (NoSuchDirectoryException nsde)
+            var tempDir = CreateTempDir("doesnotexist").FullName;
+            System.IO.Directory.Delete(tempDir, true);
+            using (Directory dir = new NRTCachingDirectory(NewFSDirectory(new DirectoryInfo(tempDir)),
2.0, 25.0))
             {
-                // expected
+                try
+                {
+                    Assert.False(System.IO.Directory.Exists(tempDir));
+                    DirectoryReader.Open(dir);
+                    Assert.Fail("did not hit expected exception");
+                }
+                catch (NoSuchDirectoryException)
+                {
+                    // expected
+                }
             }
-            dir.Dispose();
         }
 
         // LUCENE-3382 test that we can add a file, and then when we call list() we get it
back


Mime
View raw message