コード例 #1
0
        public virtual void  TestFSDirectoryDifferentLockFactory()
        {
            System.IO.FileInfo indexDirName = _TestUtil.GetTempDir("index.TestLockFactory5");

            LockFactory lf  = new SingleInstanceLockFactory();
            FSDirectory fs1 = FSDirectory.GetDirectory(indexDirName, lf);

            // Different lock factory instance should hit IOException:
            try
            {
                FSDirectory.GetDirectory(indexDirName, new SingleInstanceLockFactory());
                Assert.Fail("Should have hit an IOException because LockFactory instances differ");
            }
            catch (System.IO.IOException e)
            {
            }

            FSDirectory fs2 = null;

            // Same lock factory instance should not:
            try
            {
                fs2 = FSDirectory.GetDirectory(indexDirName, lf);
            }
            catch (System.IO.IOException e)
            {
                System.Console.Out.WriteLine(e.StackTrace);
                Assert.Fail("Should not have hit an IOException because LockFactory instances are the same");
            }

            fs1.Close();
            if (fs2 != null)
            {
                fs2.Close();
            }
            // Cleanup
            _TestUtil.RmDir(indexDirName);
        }
コード例 #2
0
 public RAMDirectory(System.String dir) : this(FSDirectory.GetDirectory(dir), true)
 {
 }
コード例 #3
0
 public RAMDirectory(System.IO.FileInfo dir) : this(FSDirectory.GetDirectory(dir), true)
 {
 }