예제 #1
0
 public virtual void  TestDontCreate()
 {
     System.IO.DirectoryInfo path = new System.IO.DirectoryInfo(System.IO.Path.Combine(AppSettings.Get("tempDir", ""), "doesnotexist"));
     try
     {
         bool tmpBool;
         if (System.IO.File.Exists(path.FullName))
         {
             tmpBool = true;
         }
         else
         {
             tmpBool = System.IO.Directory.Exists(path.FullName);
         }
         Assert.IsTrue(!tmpBool);
         Directory dir = new SimpleFSDirectory(path, null);
         bool      tmpBool2;
         if (System.IO.File.Exists(path.FullName))
         {
             tmpBool2 = true;
         }
         else
         {
             tmpBool2 = System.IO.Directory.Exists(path.FullName);
         }
         Assert.IsTrue(!tmpBool2);
         dir.Close();
     }
     finally
     {
         _TestUtil.RmDir(path);
     }
 }
예제 #2
0
        public virtual void  TestNotDirectory()
        {
            System.IO.FileInfo path  = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.AppSettings.Get("tempDir", ""), "testnotdir"));
            Directory          fsDir = new SimpleFSDirectory(path, null);

            try
            {
                IndexOutput out_Renamed = fsDir.CreateOutput("afile");
                out_Renamed.Close();
                Assert.IsTrue(fsDir.FileExists("afile"));
                try
                {
                    new SimpleFSDirectory(new System.IO.FileInfo(System.IO.Path.Combine(path.FullName, "afile")), null);
                    Assert.Fail("did not hit expected exception");
                }
                catch (NoSuchDirectoryException nsde)
                {
                    // Expected
                }
            }
            finally
            {
                fsDir.Close();
                _TestUtil.RmDir(path);
            }
        }
예제 #3
0
 public void TestFSDirectorySync()
 {
     System.IO.FileInfo         path      = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.AppSettings.Get("tempDir", ""), "testsync"));
     Lucene.Net.Store.Directory directory = new Lucene.Net.Store.SimpleFSDirectory(path, null);
     try
     {
         Lucene.Net.Store.IndexOutput io = directory.CreateOutput("syncfile");
         io.Close();
         directory.Sync("syncfile");
     }
     finally
     {
         directory.Close();
         Lucene.Net.Util._TestUtil.RmDir(path);
     }
 }
예제 #4
0
        public virtual void  TestNotDirectory()
        {
            System.IO.DirectoryInfo path = new System.IO.DirectoryInfo(System.IO.Path.Combine(AppSettings.Get("tempDir", ""), "testnotdir"));
            Directory fsDir = new SimpleFSDirectory(path, null);

            try
            {
                IndexOutput out_Renamed = fsDir.CreateOutput("afile", null);
                out_Renamed.Close();
                Assert.IsTrue(fsDir.FileExists("afile", null));

                Assert.Throws <NoSuchDirectoryException>(
                    () =>
                    new SimpleFSDirectory(new System.IO.DirectoryInfo(System.IO.Path.Combine(path.FullName, "afile")), null),
                    "did not hit expected exception");
            }
            finally
            {
                fsDir.Close();
                _TestUtil.RmDir(path);
            }
        }
예제 #5
0
		public virtual void  TestNotDirectory()
		{
			System.IO.DirectoryInfo path = new System.IO.DirectoryInfo(System.IO.Path.Combine(AppSettings.Get("tempDir", ""), "testnotdir"));
			Directory fsDir = new SimpleFSDirectory(path, null);
			try
			{
				IndexOutput out_Renamed = fsDir.CreateOutput("afile");
				out_Renamed.Close();
				Assert.IsTrue(fsDir.FileExists("afile"));

			    Assert.Throws<NoSuchDirectoryException>(
			        () =>
			        new SimpleFSDirectory(new System.IO.DirectoryInfo(System.IO.Path.Combine(path.FullName, "afile")), null),
			        "did not hit expected exception");
			}
			finally
			{
				fsDir.Close();
				_TestUtil.RmDir(path);
			}
		}
예제 #6
0
		public virtual void  TestDontCreate()
		{
			System.IO.DirectoryInfo path = new System.IO.DirectoryInfo(System.IO.Path.Combine(AppSettings.Get("tempDir", ""), "doesnotexist"));
			try
			{
				bool tmpBool;
				if (System.IO.File.Exists(path.FullName))
					tmpBool = true;
				else
					tmpBool = System.IO.Directory.Exists(path.FullName);
				Assert.IsTrue(!tmpBool);
				Directory dir = new SimpleFSDirectory(path, null);
				bool tmpBool2;
				if (System.IO.File.Exists(path.FullName))
					tmpBool2 = true;
				else
					tmpBool2 = System.IO.Directory.Exists(path.FullName);
				Assert.IsTrue(!tmpBool2);
				dir.Close();
			}
			finally
			{
				_TestUtil.RmDir(path);
			}
		}
예제 #7
0
 public void TestFSDirectorySync()
 {
     System.IO.FileInfo path = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.AppSettings.Get("tempDir", ""), "testsync"));
     Lucene.Net.Store.Directory directory = new Lucene.Net.Store.SimpleFSDirectory(path, null);
     try
     {
         Lucene.Net.Store.IndexOutput io = directory.CreateOutput("syncfile");
         io.Close();
         directory.Sync("syncfile");
     }
     finally
     {
         directory.Close();
         Lucene.Net.Util._TestUtil.RmDir(path);
     }
 }
예제 #8
0
		public virtual void  TestNotDirectory()
		{
			System.IO.FileInfo path = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.AppSettings.Get("tempDir", ""), "testnotdir"));
			Directory fsDir = new SimpleFSDirectory(path, null);
			try
			{
				IndexOutput out_Renamed = fsDir.CreateOutput("afile");
				out_Renamed.Close();
				Assert.IsTrue(fsDir.FileExists("afile"));
				try
				{
					new SimpleFSDirectory(new System.IO.FileInfo(System.IO.Path.Combine(path.FullName, "afile")), null);
					Assert.Fail("did not hit expected exception");
				}
				catch (NoSuchDirectoryException nsde)
				{
					// Expected
				}
			}
			finally
			{
				fsDir.Close();
				_TestUtil.RmDir(path);
			}
		}