lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r832486 [27/29] - in /incubator/lucene.net/trunk/C#/src: ./ Demo/DeleteFiles/ Demo/DemoLib/ Demo/IndexFiles/ Demo/IndexHtml/ Demo/SearchFiles/ Lucene.Net/ Lucene.Net/Analysis/ Lucene.Net/Document/ Lucene.Net/Index/ Lucene.Net/Search/ Lucene...
Date Tue, 03 Nov 2009 18:06:38 GMT
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestDirectory.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestDirectory.cs Tue Nov  3 18:06:27 2009
@@ -1,13 +1,13 @@
-/**
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,39 +15,233 @@
  * limitations under the License.
  */
 
+using System;
+
 using NUnit.Framework;
 
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+using _TestUtil = Lucene.Net.Util._TestUtil;
 
 namespace Lucene.Net.Store
 {
-    [TestFixture]
-    public class TestDirectory : LuceneTestCase
-    {
-        [Test]
-        public void TestDetectClose()
-        {
-            Directory dir = new RAMDirectory();
-            dir.Close();
-            try
-            {
-                dir.CreateOutput("test");
-                Assert.Fail("did not hit expected exception");
-            }
-            catch (AlreadyClosedException)
-            {
-            }
-
-            dir = FSDirectory.GetDirectory(SupportClass.AppSettings.Get("tempDir", ""));
-            dir.Close();
-            try
-            {
-                dir.CreateOutput("test");
-                Assert.Fail("did not hit expected exception");
-            }
-            catch (AlreadyClosedException)
-            {
-            }
-        }
-    }
-}
+	
+	[TestFixture]
+	public class TestDirectory:LuceneTestCase
+	{
+		
+		[Test]
+		public virtual void  TestDetectClose()
+		{
+			Directory dir = new RAMDirectory();
+			dir.Close();
+			try
+			{
+				dir.CreateOutput("test");
+				Assert.Fail("did not hit expected exception");
+			}
+			catch (AlreadyClosedException ace)
+			{
+			}
+			
+			dir = FSDirectory.Open(new System.IO.FileInfo(SupportClass.AppSettings.Get("tempDir", "")));
+			dir.Close();
+			try
+			{
+				dir.CreateOutput("test");
+				Assert.Fail("did not hit expected exception");
+			}
+			catch (AlreadyClosedException ace)
+			{
+			}
+		}
+		
+		
+		// Test that different instances of FSDirectory can coexist on the same
+		// path, can read, write, and lock files.
+		[Test]
+		public virtual void  TestDirectInstantiation()
+		{
+			System.IO.FileInfo path = new System.IO.FileInfo(SupportClass.AppSettings.Get("tempDir", ""));
+			
+			int sz = 3;
+			Directory[] dirs = new Directory[sz];
+			
+			dirs[0] = new SimpleFSDirectory(path, null);
+			dirs[1] = new NIOFSDirectory(path, null);
+			dirs[2] = new MMapDirectory(path, null);
+			
+			for (int i = 0; i < sz; i++)
+			{
+				Directory dir = dirs[i];
+				dir.EnsureOpen();
+				System.String fname = "foo." + i;
+				System.String lockname = "foo" + i + ".lck";
+				IndexOutput out_Renamed = dir.CreateOutput(fname);
+				out_Renamed.WriteByte((byte) i);
+				out_Renamed.Close();
+				
+				for (int j = 0; j < sz; j++)
+				{
+					Directory d2 = dirs[j];
+					d2.EnsureOpen();
+					Assert.IsTrue(d2.FileExists(fname));
+					Assert.AreEqual(1, d2.FileLength(fname));
+					
+					// don't test read on MMapDirectory, since it can't really be
+					// closed and will cause a failure to delete the file.
+					if (d2 is MMapDirectory)
+						continue;
+					
+					IndexInput input = d2.OpenInput(fname);
+					Assert.AreEqual((byte) i, input.ReadByte());
+					input.Close();
+				}
+				
+				// delete with a different dir
+				dirs[(i + 1) % sz].DeleteFile(fname);
+				
+				for (int j = 0; j < sz; j++)
+				{
+					Directory d2 = dirs[j];
+					Assert.IsFalse(d2.FileExists(fname));
+				}
+				
+				Lock lock_Renamed = dir.MakeLock(lockname);
+				Assert.IsTrue(lock_Renamed.Obtain());
+				
+				for (int j = 0; j < sz; j++)
+				{
+					Directory d2 = dirs[j];
+					Lock lock2 = d2.MakeLock(lockname);
+					try
+					{
+						Assert.IsFalse(lock2.Obtain(1));
+					}
+					catch (LockObtainFailedException e)
+					{
+						// OK
+					}
+				}
+				
+				lock_Renamed.Release();
+				
+				// now lock with different dir
+				lock_Renamed = dirs[(i + 1) % sz].MakeLock(lockname);
+				Assert.IsTrue(lock_Renamed.Obtain());
+				lock_Renamed.Release();
+			}
+			
+			for (int i = 0; i < sz; i++)
+			{
+				Directory dir = dirs[i];
+				dir.EnsureOpen();
+				dir.Close();
+                Assert.IsFalse(dir.isOpen_ForNUnit);
+			}
+		}
+		
+		// LUCENE-1464
+		[Test]
+		public virtual void  TestDontCreate()
+		{
+			System.IO.FileInfo path = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.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);
+			}
+		}
+		
+		// LUCENE-1468
+		[Test]
+		public virtual void  TestRAMDirectoryFilter()
+		{
+			CheckDirectoryFilter(new RAMDirectory());
+		}
+		
+		// LUCENE-1468
+		[Test]
+		public virtual void  TestFSDirectoryFilter()
+		{
+			CheckDirectoryFilter(FSDirectory.Open(new System.IO.FileInfo("test")));
+		}
+		
+		// LUCENE-1468
+		private void  CheckDirectoryFilter(Directory dir)
+		{
+			System.String name = "file";
+			try
+			{
+				dir.CreateOutput(name).Close();
+				Assert.IsTrue(dir.FileExists(name));
+				Assert.IsTrue(new System.Collections.ArrayList(dir.ListAll()).Contains(name));
+			}
+			finally
+			{
+				dir.Close();
+			}
+		}
+		
+		// LUCENE-1468
+		[Test]
+		public virtual void  TestCopySubdir()
+		{
+			System.IO.FileInfo path = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.AppSettings.Get("tempDir", ""), "testsubdir"));
+			try
+			{
+				System.IO.Directory.CreateDirectory(path.FullName);
+				System.IO.Directory.CreateDirectory(new System.IO.FileInfo(System.IO.Path.Combine(path.FullName, "subdir")).FullName);
+				Directory fsDir = new SimpleFSDirectory(path, null);
+				Assert.AreEqual(0, new RAMDirectory(fsDir).ListAll().Length);
+			}
+			finally
+			{
+				_TestUtil.RmDir(path);
+			}
+		}
+		
+		// LUCENE-1468
+		[Test]
+		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);
+			}
+		}
+	}
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Test/Store/TestFileSwitchDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestFileSwitchDirectory.cs?rev=832486&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestFileSwitchDirectory.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestFileSwitchDirectory.cs Tue Nov  3 18:06:27 2009
@@ -0,0 +1,80 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+using NUnit.Framework;
+
+using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using TestIndexWriterReader = Lucene.Net.Index.TestIndexWriterReader;
+using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+namespace Lucene.Net.Store
+{
+	
+    [TestFixture]
+	public class TestFileSwitchDirectory:LuceneTestCase
+	{
+		/// <summary> Test if writing doc stores to disk and everything else to ram works.</summary>
+		/// <throws>  IOException </throws>
+        [Test]
+		public virtual void  TestBasic()
+		{
+			System.Collections.Hashtable fileExtensions = new System.Collections.Hashtable();
+			SupportClass.CollectionsHelper.AddIfNotContains(fileExtensions, "fdt");
+			SupportClass.CollectionsHelper.AddIfNotContains(fileExtensions, "fdx");
+			
+			Directory primaryDir = new MockRAMDirectory();
+			RAMDirectory secondaryDir = new MockRAMDirectory();
+			
+			FileSwitchDirectory fsd = new FileSwitchDirectory(fileExtensions, primaryDir, secondaryDir, true);
+			IndexWriter writer = new IndexWriter(fsd, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
+			writer.SetUseCompoundFile(false);
+			TestIndexWriterReader.CreateIndexNoClose(true, "ram", writer);
+			IndexReader reader = writer.GetReader();
+			Assert.AreEqual(100, reader.MaxDoc());
+			writer.Commit();
+			// we should see only fdx,fdt files here
+			System.String[] files = primaryDir.ListAll();
+			Assert.IsTrue(files.Length > 0);
+			for (int x = 0; x < files.Length; x++)
+			{
+				System.String ext = FileSwitchDirectory.GetExtension(files[x]);
+				Assert.IsTrue(fileExtensions.Contains(ext));
+			}
+			files = secondaryDir.ListAll();
+			Assert.IsTrue(files.Length > 0);
+			// we should not see fdx,fdt files here
+			for (int x = 0; x < files.Length; x++)
+			{
+				System.String ext = FileSwitchDirectory.GetExtension(files[x]);
+				Assert.IsFalse(fileExtensions.Contains(ext));
+			}
+			reader.Close();
+			writer.Close();
+			
+			files = fsd.ListAll();
+			for (int i = 0; i < files.Length; i++)
+			{
+				Assert.IsNotNull(files[i]);
+			}
+			fsd.Close();
+		}
+	}
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestHugeRamFile.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestHugeRamFile.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestHugeRamFile.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestHugeRamFile.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -26,21 +26,20 @@
 	
 	/// <summary>Test huge RAMFile with more than Integer.MAX_VALUE bytes. </summary>
 	[TestFixture]
-	public class TestHugeRamFile : LuceneTestCase
+	public class TestHugeRamFile:LuceneTestCase
 	{
-
-        //private static readonly long MAX_VALUE = (long)2 * (long)System.Int32.MaxValue; // around 4 GB of memory
-        private static readonly long MAX_VALUE = (long)System.Int32.MaxValue >> 1; // around 1 GB of mem
+		
+		private static readonly long MAX_VALUE = (long) 2 * (long) System.Int32.MaxValue;
 		
 		/// <summary>Fake a huge ram file by using the same byte buffer for all 
 		/// buffers under maxint. 
 		/// </summary>
 		[Serializable]
-		private class DenseRAMFile : RAMFile
+		private class DenseRAMFile:RAMFile
 		{
 			private long capacity = 0;
 			private System.Collections.Hashtable singleBuffers = new System.Collections.Hashtable();
-			protected override byte[] NewBuffer(int size)
+			public /*internal*/ override byte[] NewBuffer(int size)
 			{
 				capacity += size;
 				if (capacity <= Lucene.Net.Store.TestHugeRamFile.MAX_VALUE)
@@ -67,8 +66,8 @@
 			DenseRAMFile f = new DenseRAMFile();
 			// output part
 			RAMOutputStream out_Renamed = new RAMOutputStream(f);
-			byte[] b1 = new byte[RAMOutputStream.BUFFER_SIZE_ForNUnitTest];
-			byte[] b2 = new byte[RAMOutputStream.BUFFER_SIZE_ForNUnitTest / 3];
+			byte[] b1 = new byte[RAMOutputStream.BUFFER_SIZE_ForNUnit];
+			byte[] b2 = new byte[RAMOutputStream.BUFFER_SIZE_ForNUnit / 3];
 			for (int i = 0; i < b1.Length; i++)
 			{
 				b1[i] = (byte) (i & 0x0007F);
@@ -102,7 +101,7 @@
 			}
 			out_Renamed.Close();
 			// input part
-			RAMInputStream in_Renamed = RAMInputStream.RAMInputStream_ForNUnitTest(f);
+			RAMInputStream in_Renamed = new RAMInputStream(f);
 			Assert.AreEqual(n, in_Renamed.Length(), "input length must match");
 			//System.out.println("input length = "+in.length()+" % 1024 = "+in.length()%1024);
 			for (int j = 0; j < L; j++)

Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestLock.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestLock.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestLock.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestLock.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -15,60 +15,6 @@
  * limitations under the License.
  */
 
-/* ====================================================================
-* The Apache Software License, Version 1.1
-*
-* Copyright (c) 2001,2004 The Apache Software Foundation.  All rights
-* reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1. Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*
-* 2. Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in
-*    the documentation and/or other materials provided with the
-*    distribution.
-*
-* 3. The end-user documentation included with the redistribution,
-*    if any, must include the following acknowledgment:
-*       "This product includes software developed by the
-*        Apache Software Foundation (http://www.apache.org/)."
-*    Alternately, this acknowledgment may appear in the software itself,
-*    if and wherever such third-party acknowledgments normally appear.
-*
-* 4. The names "Apache" and "Apache Software Foundation" and
-*    "Apache Lucene" must not be used to endorse or promote products
-*    derived from this software without prior written permission. For
-*    written permission, please contact apache@apache.org.
-*
-* 5. Products derived from this software may not be called "Apache",
-*    "Apache Lucene", nor may "Apache" appear in their name, without
-*    prior written permission of the Apache Software Foundation.
-*
-* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-* ====================================================================
-*
-* This software consists of voluntary contributions made by many
-* individuals on behalf of the Apache Software Foundation.  For more
-* information on the Apache Software Foundation, please see
-* <http://www.apache.org/>.
-*/
-
 using System;
 
 using NUnit.Framework;
@@ -79,27 +25,27 @@
 {
 	
 	[TestFixture]
-	public class TestLock : LuceneTestCase
+	public class TestLock:LuceneTestCase
 	{
 		
 		[Test]
 		public virtual void  TestObtain()
 		{
 			LockMock lock_Renamed = new LockMock(this);
-			Lucene.Net.Store.Lock.LOCK_POLL_INTERVAL = 10;
+			Lock.LOCK_POLL_INTERVAL = 10;
 			
 			try
 			{
-				lock_Renamed.Obtain(Lucene.Net.Store.Lock.LOCK_POLL_INTERVAL);
+				lock_Renamed.Obtain(Lock.LOCK_POLL_INTERVAL);
 				Assert.Fail("Should have failed to obtain lock");
 			}
-			catch (System.IO.IOException)
+			catch (System.IO.IOException e)
 			{
 				Assert.AreEqual(lock_Renamed.lockAttempts, 2, "should attempt to lock more than once");
 			}
 		}
 		
-		private class LockMock : Lucene.Net.Store.Lock
+		private class LockMock:Lock
 		{
 			public LockMock(TestLock enclosingInstance)
 			{
@@ -110,10 +56,6 @@
 				this.enclosingInstance = enclosingInstance;
 			}
 			private TestLock enclosingInstance;
-			override public bool IsLocked()
-			{
-				return false;
-			}
 			public TestLock Enclosing_Instance
 			{
 				get
@@ -133,6 +75,10 @@
 			{
 				// do nothing
 			}
+			public override bool IsLocked()
+			{
+				return false;
+			}
 		}
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestLockFactory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestLockFactory.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestLockFactory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestLockFactory.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -29,16 +29,18 @@
 using ScoreDoc = Lucene.Net.Search.ScoreDoc;
 using TermQuery = Lucene.Net.Search.TermQuery;
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+using _TestUtil = Lucene.Net.Util._TestUtil;
 
 namespace Lucene.Net.Store
 {
 	
 	[TestFixture]
-	public class TestLockFactory : LuceneTestCase
+	public class TestLockFactory:LuceneTestCase
 	{
 		
 		// Verify: we can provide our own LockFactory implementation, the right
 		// methods are called at the right time, locks are created, etc.
+		
 		[Test]
 		public virtual void  TestCustomLockFactory()
 		{
@@ -122,7 +124,7 @@
 				writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
 				Assert.Fail("Should have hit an IOException with two IndexWriters on default SingleInstanceLockFactory");
 			}
-			catch (System.IO.IOException)
+			catch (System.IO.IOException e)
 			{
 			}
 			
@@ -138,7 +140,7 @@
 		[Test]
 		public virtual void  TestDefaultFSDirectory()
 		{
-			System.String indexDirName = "index.TestLockFactory1";
+			System.IO.FileInfo indexDirName = _TestUtil.GetTempDir("index.TestLockFactory1");
 			
 			IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
 			
@@ -152,7 +154,7 @@
 				writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
 				Assert.Fail("Should have hit an IOException with two IndexWriters on default SimpleFSLockFactory");
 			}
-			catch (System.IO.IOException)
+			catch (System.IO.IOException e)
 			{
 			}
 			
@@ -163,14 +165,14 @@
 			}
 			
 			// Cleanup
-			RmDir(indexDirName);
+			_TestUtil.RmDir(indexDirName);
 		}
 		
 		// Verify: FSDirectory's default lockFactory clears all locks correctly
 		[Test]
 		public virtual void  TestFSDirectoryTwoCreates()
 		{
-			System.String indexDirName = "index.TestLockFactory2";
+			System.IO.FileInfo indexDirName = _TestUtil.GetTempDir("index.TestLockFactory2");
 			
 			IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
 			
@@ -198,7 +200,7 @@
 			}
 			catch (System.IO.IOException e)
 			{
-				System.Console.Error.WriteLine(e.StackTrace);
+				System.Console.Out.WriteLine(e.StackTrace);
 				Assert.Fail("Should not have hit an IOException with two IndexWriters with create=true, on default SimpleFSLockFactory");
 			}
 			
@@ -210,14 +212,14 @@
 					writer2.Close();
 					// expected
 				}
-				catch (LockReleaseFailedException)
+				catch (LockReleaseFailedException e)
 				{
 					Assert.Fail("writer2.close() should not have hit LockReleaseFailedException");
 				}
 			}
 			
 			// Cleanup
-			RmDir(indexDirName);
+			_TestUtil.RmDir(indexDirName);
 		}
 		
 		
@@ -228,7 +230,7 @@
 		[Test]
 		public virtual void  TestLockClassProperty()
 		{
-			System.String indexDirName = "index.TestLockFactory3";
+			System.IO.FileInfo indexDirName = _TestUtil.GetTempDir("index.TestLockFactory3");
 			System.String prpName = "Lucene.Net.Store.FSDirectoryLockFactoryClass";
 			
 			try
@@ -265,14 +267,14 @@
 			}
 			
 			// Cleanup
-			RmDir(indexDirName);
+			_TestUtil.RmDir(indexDirName);
 		}
 		
 		// Verify: setDisableLocks works
 		[Test]
 		public virtual void  TestDisableLocks()
 		{
-			System.String indexDirName = "index.TestLockFactory4";
+			System.IO.FileInfo indexDirName = _TestUtil.GetTempDir("index.TestLockFactory4");
 			
 			Assert.IsTrue(!FSDirectory.GetDisableLocks(), "Locks are already disabled");
 			FSDirectory.SetDisableLocks(true);
@@ -289,7 +291,7 @@
 			}
 			catch (System.IO.IOException e)
 			{
-				System.Console.Error.WriteLine(e.StackTrace);
+				System.Console.Out.WriteLine(e.StackTrace);
 				Assert.Fail("Should not have hit an IOException with locking disabled");
 			}
 			
@@ -300,14 +302,14 @@
 				writer2.Close();
 			}
 			// Cleanup
-			RmDir(indexDirName);
+			_TestUtil.RmDir(indexDirName);
 		}
 		
 		// Verify: if I try to getDirectory() with two different locking implementations, I get an IOException
 		[Test]
 		public virtual void  TestFSDirectoryDifferentLockFactory()
 		{
-			System.String indexDirName = "index.TestLockFactory5";
+			System.IO.FileInfo indexDirName = _TestUtil.GetTempDir("index.TestLockFactory5");
 			
 			LockFactory lf = new SingleInstanceLockFactory();
 			FSDirectory fs1 = FSDirectory.GetDirectory(indexDirName, lf);
@@ -315,33 +317,33 @@
 			// Different lock factory instance should hit IOException:
 			try
 			{
-				FSDirectory fs2 = FSDirectory.GetDirectory(indexDirName, new SingleInstanceLockFactory());
+				FSDirectory.GetDirectory(indexDirName, new SingleInstanceLockFactory());
 				Assert.Fail("Should have hit an IOException because LockFactory instances differ");
 			}
-			catch (System.IO.IOException)
+			catch (System.IO.IOException e)
 			{
 			}
 			
-			FSDirectory fs3 = null;
+			FSDirectory fs2 = null;
 			
 			// Same lock factory instance should not:
 			try
 			{
-				fs3 = FSDirectory.GetDirectory(indexDirName, lf);
+				fs2 = FSDirectory.GetDirectory(indexDirName, lf);
 			}
 			catch (System.IO.IOException e)
 			{
-				System.Console.Error.WriteLine(e.StackTrace);
+				System.Console.Out.WriteLine(e.StackTrace);
 				Assert.Fail("Should not have hit an IOException because LockFactory instances are the same");
 			}
 			
 			fs1.Close();
-			if (fs3 != null)
+			if (fs2 != null)
 			{
-				fs3.Close();
+				fs2.Close();
 			}
 			// Cleanup
-			RmDir(indexDirName);
+			_TestUtil.RmDir(indexDirName);
 		}
 		
 		// Verify: do stress test, by opening IndexReaders and
@@ -350,24 +352,26 @@
 		[Test]
 		public virtual void  TestStressLocks()
 		{
-			_TestStressLocks(null, "index.TestLockFactory6");
+			_testStressLocks(null, _TestUtil.GetTempDir("index.TestLockFactory6"));
 		}
 		
 		// Verify: do stress test, by opening IndexReaders and
 		// IndexWriters over & over in 2 threads and making sure
 		// no unexpected exceptions are raised, but use
 		// NativeFSLockFactory:
-		public virtual void  testStressLocksNativeFSLockFactory()
+		[Test]
+		public virtual void  TestStressLocksNativeFSLockFactory()
 		{
-			_TestStressLocks(new NativeFSLockFactory("index.TestLockFactory7"), "index.TestLockFactory7");
+			System.IO.FileInfo dir = _TestUtil.GetTempDir("index.TestLockFactory7");
+			_testStressLocks(new NativeFSLockFactory(dir), dir);
 		}
 		
-		public virtual void  _TestStressLocks(LockFactory lockFactory, System.String indexDirName)
+		public virtual void  _testStressLocks(LockFactory lockFactory, System.IO.FileInfo indexDir)
 		{
-			FSDirectory fs1 = FSDirectory.GetDirectory(indexDirName, lockFactory);
+			FSDirectory fs1 = FSDirectory.Open(indexDir, lockFactory);
 			
 			// First create a 1 doc index:
-			IndexWriter w = new IndexWriter(fs1, new WhitespaceAnalyzer(), true);
+			IndexWriter w = new IndexWriter(fs1, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
 			AddDoc(w);
 			w.Close();
 			
@@ -378,31 +382,22 @@
 			
 			while (writer.IsAlive || searcher.IsAlive)
 			{
-				try
-				{
-					System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 1000));
-				}
-				catch (System.Threading.ThreadInterruptedException)
-				{
-				}
+				System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 1000));
 			}
 			
 			Assert.IsTrue(!writer.hitException, "IndexWriter hit unexpected exceptions");
 			Assert.IsTrue(!searcher.hitException, "IndexSearcher hit unexpected exceptions");
 			
 			// Cleanup
-			RmDir(indexDirName);
+			_TestUtil.RmDir(indexDir);
 		}
 		
 		// Verify: NativeFSLockFactory works correctly
 		[Test]
 		public virtual void  TestNativeFSLockFactory()
 		{
-			System.String altTempDir = System.IO.Path.GetTempPath();
-
-			NativeFSLockFactory f = new NativeFSLockFactory(SupportClass.AppSettings.Get("tempDir", altTempDir));
 			
-			NativeFSLockFactory f2 = new NativeFSLockFactory(SupportClass.AppSettings.Get("tempDir", altTempDir));
+			NativeFSLockFactory f = new NativeFSLockFactory(SupportClass.AppSettings.Get("tempDir", ""));
 			
 			f.SetLockPrefix("test");
 			Lock l = f.MakeLock("commit");
@@ -415,27 +410,34 @@
 			Assert.IsTrue(l2.Obtain(), "failed to obtain 2nd lock after first one was freed");
 			l2.Release();
 			
-			// Make sure we can obtain first one again:
+			// Make sure we can obtain first one again, test isLocked():
 			Assert.IsTrue(l.Obtain(), "failed to obtain lock");
+			Assert.IsTrue(l.IsLocked());
+			Assert.IsTrue(l2.IsLocked());
 			l.Release();
+			Assert.IsFalse(l.IsLocked());
+			Assert.IsFalse(l2.IsLocked());
 		}
 		
-		// Verify: NativeFSLockFactory assigns different lock
-		// prefixes to different directories:
+		// Verify: NativeFSLockFactory assigns null as lockPrefix if the lockDir is inside directory
 		[Test]
 		public virtual void  TestNativeFSLockFactoryPrefix()
 		{
 			
-			// Make sure we get identical instances:
-			Directory dir1 = FSDirectory.GetDirectory("TestLockFactory.8", new NativeFSLockFactory("TestLockFactory.8"));
-			Directory dir2 = FSDirectory.GetDirectory("TestLockFactory.9", new NativeFSLockFactory("TestLockFactory.9"));
+			System.IO.FileInfo fdir1 = _TestUtil.GetTempDir("TestLockFactory.8");
+			System.IO.FileInfo fdir2 = _TestUtil.GetTempDir("TestLockFactory.8.Lockdir");
+			Directory dir1 = FSDirectory.Open(fdir1, new NativeFSLockFactory(fdir1));
+			// same directory, but locks are stored somewhere else. The prefix of the lock factory should != null
+			Directory dir2 = FSDirectory.Open(fdir1, new NativeFSLockFactory(fdir2));
 			
 			System.String prefix1 = dir1.GetLockFactory().GetLockPrefix();
+			Assert.IsNull(prefix1, "Lock prefix for lockDir same as directory should be null");
+			
 			System.String prefix2 = dir2.GetLockFactory().GetLockPrefix();
+			Assert.IsNotNull(prefix2, "Lock prefix for lockDir outside of directory should be not null");
 			
-			Assert.IsTrue(!prefix1.Equals(prefix2), "Native Lock Factories are incorrectly shared: dir1 and dir2 have same lock prefix '" + prefix1 + "'; they should be different");
-			RmDir("TestLockFactory.8");
-			RmDir("TestLockFactory.9");
+			_TestUtil.RmDir(fdir1);
+			_TestUtil.RmDir(fdir2);
 		}
 		
 		// Verify: default LockFactory has no prefix (ie
@@ -445,16 +447,17 @@
 		{
 			
 			// Make sure we get null prefix:
-			Directory dir = FSDirectory.GetDirectory("TestLockFactory.10");
+			System.IO.FileInfo dirName = _TestUtil.GetTempDir("TestLockFactory.10");
+			Directory dir = FSDirectory.Open(dirName);
 			
 			System.String prefix = dir.GetLockFactory().GetLockPrefix();
 			
 			Assert.IsTrue(null == prefix, "Default lock prefix should be null");
 			
-			RmDir("TestLockFactory.10");
+			_TestUtil.RmDir(dirName);
 		}
 		
-		private class WriterThread : SupportClass.ThreadClass
+		private class WriterThread:SupportClass.ThreadClass
 		{
 			private void  InitBlock(TestLockFactory enclosingInstance)
 			{
@@ -493,6 +496,8 @@
 						if (e.ToString().IndexOf(" timed out:") == - 1)
 						{
 							hitException = true;
+							System.Console.Out.WriteLine("Stress Test Index Writer: creation hit unexpected IOException: " + e.ToString());
+							System.Console.Out.WriteLine(e.StackTrace);
 						}
 						else
 						{
@@ -508,7 +513,7 @@
 					{
 						hitException = true;
 						System.Console.Out.WriteLine("Stress Test Index Writer: creation hit unexpected exception: " + e.ToString());
-						System.Console.Error.WriteLine(e.StackTrace);
+						System.Console.Out.WriteLine(e.StackTrace);
 						break;
 					}
 					if (writer != null)
@@ -520,8 +525,8 @@
 						catch (System.IO.IOException e)
 						{
 							hitException = true;
-							System.Console.Out.WriteLine("Stress Test Index Writer: AddDoc hit unexpected exception: " + e.ToString());
-							System.Console.Error.WriteLine(e.StackTrace);
+							System.Console.Out.WriteLine("Stress Test Index Writer: addDoc hit unexpected exception: " + e.ToString());
+							System.Console.Out.WriteLine(e.StackTrace);
 							break;
 						}
 						try
@@ -532,7 +537,7 @@
 						{
 							hitException = true;
 							System.Console.Out.WriteLine("Stress Test Index Writer: close hit unexpected exception: " + e.ToString());
-							System.Console.Error.WriteLine(e.StackTrace);
+							System.Console.Out.WriteLine(e.StackTrace);
 							break;
 						}
 						writer = null;
@@ -541,7 +546,7 @@
 			}
 		}
 		
-		private class SearcherThread : SupportClass.ThreadClass
+		private class SearcherThread:SupportClass.ThreadClass
 		{
 			private void  InitBlock(TestLockFactory enclosingInstance)
 			{
@@ -568,7 +573,6 @@
 			override public void  Run()
 			{
 				IndexSearcher searcher = null;
-				WhitespaceAnalyzer analyzer = new WhitespaceAnalyzer();
 				Query query = new TermQuery(new Term("content", "aaa"));
 				for (int i = 0; i < this.numIteration; i++)
 				{
@@ -580,7 +584,7 @@
 					{
 						hitException = true;
 						System.Console.Out.WriteLine("Stress Test Index Searcher: create hit unexpected exception: " + e.ToString());
-						System.Console.Error.WriteLine(e.StackTrace);
+						System.Console.Out.WriteLine(e.StackTrace);
 						break;
 					}
 					if (searcher != null)
@@ -594,7 +598,7 @@
 						{
 							hitException = true;
 							System.Console.Out.WriteLine("Stress Test Index Searcher: search hit unexpected exception: " + e.ToString());
-							System.Console.Error.WriteLine(e.StackTrace);
+							System.Console.Out.WriteLine(e.StackTrace);
 							break;
 						}
 						// System.out.println(hits.length() + " total results");
@@ -615,7 +619,7 @@
 			}
 		}
 		
-		public class MockLockFactory : LockFactory
+		public class MockLockFactory:LockFactory
 		{
 			public MockLockFactory(TestLockFactory enclosingInstance)
 			{
@@ -636,7 +640,7 @@
 			}
 			
 			public bool lockPrefixSet;
-			public System.Collections.Hashtable locksCreated = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
+			public System.Collections.IDictionary locksCreated = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable(new System.Collections.Hashtable()));
 			public int makeLockCount = 0;
 			
 			public override void  SetLockPrefix(System.String lockPrefix)
@@ -660,7 +664,7 @@
 			{
 			}
 			
-			public class MockLock : Lock
+			public class MockLock:Lock
 			{
 				public MockLock(MockLockFactory enclosingInstance)
 				{
@@ -703,43 +707,5 @@
 			doc.Add(new Field("content", "aaa", Field.Store.NO, Field.Index.ANALYZED));
 			writer.AddDocument(doc);
 		}
-		
-		private void  RmDir(System.String dirName)
-		{
-			System.IO.FileInfo dir = new System.IO.FileInfo(dirName);
-			System.String[] files = System.IO.Directory.GetFileSystemEntries(dir.FullName); // clear old files
-			for (int i = 0; i < files.Length; i++)
-			{
-				System.IO.FileInfo file = new System.IO.FileInfo(files[i]);
-				bool tmpBool;
-				if (System.IO.File.Exists(file.FullName))
-				{
-					System.IO.File.Delete(file.FullName);
-					tmpBool = true;
-				}
-				else if (System.IO.Directory.Exists(file.FullName))
-				{
-					System.IO.Directory.Delete(file.FullName);
-					tmpBool = true;
-				}
-				else
-					tmpBool = false;
-				bool generatedAux = tmpBool;
-			}
-			bool tmpBool2;
-			if (System.IO.File.Exists(dir.FullName))
-			{
-				System.IO.File.Delete(dir.FullName);
-				tmpBool2 = true;
-			}
-			else if (System.IO.Directory.Exists(dir.FullName))
-			{
-				System.IO.Directory.Delete(dir.FullName);
-				tmpBool2 = true;
-			}
-			else
-				tmpBool2 = false;
-			bool generatedAux2 = tmpBool2;
-		}
 	}
 }
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Test/Store/TestRAMDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestRAMDirectory.cs?rev=832486&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestRAMDirectory.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestRAMDirectory.cs Tue Nov  3 18:06:27 2009
@@ -0,0 +1,319 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+using NUnit.Framework;
+
+using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
+using Document = Lucene.Net.Documents.Document;
+using Field = Lucene.Net.Documents.Field;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using IndexSearcher = Lucene.Net.Search.IndexSearcher;
+using English = Lucene.Net.Util.English;
+using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+namespace Lucene.Net.Store
+{
+	
+	/// <summary> JUnit testcase to test RAMDirectory. RAMDirectory itself is used in many testcases,
+	/// but not one of them uses an different constructor other than the default constructor.
+	/// 
+	/// 
+	/// </summary>
+	/// <version>  $Id: RAMDirectory.java 150537 2004-09-28 22:45:26 +0200 (Di, 28 Sep 2004) cutting $
+	/// </version>
+    [TestFixture]
+	public class TestRAMDirectory:LuceneTestCase
+	{
+		private class AnonymousClassThread:SupportClass.ThreadClass
+		{
+			public AnonymousClassThread(int num, Lucene.Net.Index.IndexWriter writer, Lucene.Net.Store.MockRAMDirectory ramDir, TestRAMDirectory enclosingInstance)
+			{
+				InitBlock(num, writer, ramDir, enclosingInstance);
+			}
+			private void  InitBlock(int num, Lucene.Net.Index.IndexWriter writer, Lucene.Net.Store.MockRAMDirectory ramDir, TestRAMDirectory enclosingInstance)
+			{
+				this.num = num;
+				this.writer = writer;
+				this.ramDir = ramDir;
+				this.enclosingInstance = enclosingInstance;
+			}
+			private int num;
+			private Lucene.Net.Index.IndexWriter writer;
+			private Lucene.Net.Store.MockRAMDirectory ramDir;
+			private TestRAMDirectory enclosingInstance;
+			public TestRAMDirectory Enclosing_Instance
+			{
+				get
+				{
+					return enclosingInstance;
+				}
+				
+			}
+			override public void  Run()
+			{
+				for (int j = 1; j < Enclosing_Instance.docsPerThread; j++)
+				{
+					Document doc = new Document();
+					doc.Add(new Field("sizeContent", English.IntToEnglish(num * Enclosing_Instance.docsPerThread + j).Trim(), Field.Store.YES, Field.Index.NOT_ANALYZED));
+					try
+					{
+						writer.AddDocument(doc);
+					}
+					catch (System.IO.IOException e)
+					{
+						throw new System.SystemException("", e);
+					}
+					lock (ramDir)
+					{
+						Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());
+					}
+				}
+			}
+		}
+		
+		private System.IO.FileInfo indexDir = null;
+		
+		// add enough document so that the index will be larger than RAMDirectory.READ_BUFFER_SIZE
+		private int docsToAdd = 500;
+		
+		// setup the index
+		[Test]
+		public override void  SetUp()
+		{
+			base.SetUp();
+			System.String tempDir = System.IO.Path.GetTempPath();
+			if (tempDir == null)
+				throw new System.IO.IOException("java.io.tmpdir undefined, cannot run test");
+			indexDir = new System.IO.FileInfo(tempDir + "\\" + "RAMDirIndex");
+			
+			IndexWriter writer = new IndexWriter(indexDir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
+			// add some documents
+			Document doc = null;
+			for (int i = 0; i < docsToAdd; i++)
+			{
+				doc = new Document();
+				doc.Add(new Field("content", English.IntToEnglish(i).Trim(), Field.Store.YES, Field.Index.NOT_ANALYZED));
+				writer.AddDocument(doc);
+			}
+			Assert.AreEqual(docsToAdd, writer.DocCount());
+			writer.Close();
+		}
+		
+        [Test]
+		public virtual void  TestRAMDirectory_Renamed()
+		{
+			
+			Directory dir = FSDirectory.Open(indexDir);
+			MockRAMDirectory ramDir = new MockRAMDirectory(dir);
+			
+			// close the underlaying directory
+			dir.Close();
+			
+			// Check size
+			Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());
+			
+			// open reader to test document count
+			IndexReader reader = IndexReader.Open(ramDir);
+			Assert.AreEqual(docsToAdd, reader.NumDocs());
+			
+			// open search zo check if all doc's are there
+			IndexSearcher searcher = new IndexSearcher(reader);
+			
+			// search for all documents
+			for (int i = 0; i < docsToAdd; i++)
+			{
+				Document doc = searcher.Doc(i);
+				Assert.IsTrue(doc.GetField("content") != null);
+			}
+			
+			// cleanup
+			reader.Close();
+			searcher.Close();
+		}
+		
+        [Test]
+		public virtual void  TestRAMDirectoryFile()
+		{
+			
+			MockRAMDirectory ramDir = new MockRAMDirectory(indexDir);
+			
+			// Check size
+			Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());
+			
+			// open reader to test document count
+			IndexReader reader = IndexReader.Open(ramDir);
+			Assert.AreEqual(docsToAdd, reader.NumDocs());
+			
+			// open search zo check if all doc's are there
+			IndexSearcher searcher = new IndexSearcher(reader);
+			
+			// search for all documents
+			for (int i = 0; i < docsToAdd; i++)
+			{
+				Document doc = searcher.Doc(i);
+				Assert.IsTrue(doc.GetField("content") != null);
+			}
+			
+			// cleanup
+			reader.Close();
+			searcher.Close();
+		}
+		
+        [Test]
+		public virtual void  TestRAMDirectoryString()
+		{
+			
+			MockRAMDirectory ramDir = new MockRAMDirectory(indexDir.FullName);
+			
+			// Check size
+			Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());
+			
+			// open reader to test document count
+			IndexReader reader = IndexReader.Open(ramDir);
+			Assert.AreEqual(docsToAdd, reader.NumDocs());
+			
+			// open search zo check if all doc's are there
+			IndexSearcher searcher = new IndexSearcher(reader);
+			
+			// search for all documents
+			for (int i = 0; i < docsToAdd; i++)
+			{
+				Document doc = searcher.Doc(i);
+				Assert.IsTrue(doc.GetField("content") != null);
+			}
+			
+			// cleanup
+			reader.Close();
+			searcher.Close();
+		}
+		
+		private int numThreads = 50;
+		private int docsPerThread = 40;
+		
+        [Test]
+		public virtual void  TestRAMDirectorySize()
+		{
+			
+			MockRAMDirectory ramDir = new MockRAMDirectory(indexDir.FullName);
+			IndexWriter writer = new IndexWriter(ramDir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
+			writer.Optimize();
+			
+			Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());
+			
+			SupportClass.ThreadClass[] threads = new SupportClass.ThreadClass[numThreads];
+			for (int i = 0; i < numThreads; i++)
+			{
+				int num = i;
+				threads[i] = new AnonymousClassThread(num, writer, ramDir, this);
+			}
+			for (int i = 0; i < numThreads; i++)
+				threads[i].Start();
+			for (int i = 0; i < numThreads; i++)
+				threads[i].Join();
+			
+			writer.Optimize();
+			Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());
+			
+			writer.Close();
+		}
+		
+		
+        [Test]
+		public virtual void  TestSerializable()
+		{
+			Directory dir = new RAMDirectory();
+			System.IO.MemoryStream bos = new System.IO.MemoryStream(1024);
+			Assert.AreEqual(0, bos.Length, "initially empty");
+			System.IO.BinaryWriter out_Renamed = new System.IO.BinaryWriter(bos);
+			long headerSize = bos.Length;
+	        System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
+	        formatter.Serialize(out_Renamed.BaseStream, dir);
+			out_Renamed.Close();
+			Assert.IsTrue(headerSize < bos.Length, "contains more then just header");
+		}
+		
+		[TearDown]
+		public override void  TearDown()
+		{
+			base.TearDown();
+			// cleanup 
+			bool tmpBool;
+			if (System.IO.File.Exists(indexDir.FullName))
+				tmpBool = true;
+			else
+				tmpBool = System.IO.Directory.Exists(indexDir.FullName);
+			if (indexDir != null && tmpBool)
+			{
+				RmDir(indexDir);
+			}
+		}
+		
+		// LUCENE-1196
+        [Test]
+		public virtual void  TestIllegalEOF()
+		{
+			RAMDirectory dir = new RAMDirectory();
+			IndexOutput o = dir.CreateOutput("out");
+			byte[] b = new byte[1024];
+			o.WriteBytes(b, 0, 1024);
+			o.Close();
+			IndexInput i = dir.OpenInput("out");
+			i.Seek(1024);
+			i.Close();
+			dir.Close();
+		}
+		
+		private void  RmDir(System.IO.FileInfo dir)
+		{
+			System.IO.FileInfo[] files = SupportClass.FileSupport.GetFiles(dir);
+			for (int i = 0; i < files.Length; i++)
+			{
+				bool tmpBool;
+				if (System.IO.File.Exists(files[i].FullName))
+				{
+					System.IO.File.Delete(files[i].FullName);
+					tmpBool = true;
+				}
+				else if (System.IO.Directory.Exists(files[i].FullName))
+				{
+					System.IO.Directory.Delete(files[i].FullName);
+					tmpBool = true;
+				}
+				else
+					tmpBool = false;
+				bool generatedAux = tmpBool;
+			}
+			bool tmpBool2;
+			if (System.IO.File.Exists(dir.FullName))
+			{
+				System.IO.File.Delete(dir.FullName);
+				tmpBool2 = true;
+			}
+			else if (System.IO.Directory.Exists(dir.FullName))
+			{
+				System.IO.Directory.Delete(dir.FullName);
+				tmpBool2 = true;
+			}
+			else
+				tmpBool2 = false;
+			bool generatedAux2 = tmpBool2;
+		}
+	}
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestWindowsMMap.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestWindowsMMap.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestWindowsMMap.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestWindowsMMap.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -19,10 +19,10 @@
 
 using NUnit.Framework;
 
+using StandardAnalyzer = Lucene.Net.Analysis.Standard.StandardAnalyzer;
 using Document = Lucene.Net.Documents.Document;
 using Field = Lucene.Net.Documents.Field;
 using IndexWriter = Lucene.Net.Index.IndexWriter;
-using StandardAnalyzer = Lucene.Net.Analysis.Standard.StandardAnalyzer;
 using IndexSearcher = Lucene.Net.Search.IndexSearcher;
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 
@@ -30,18 +30,17 @@
 {
 	
 	[TestFixture]
-	public class TestWindowsMMap : LuceneTestCase
+	public class TestWindowsMMap:LuceneTestCase
 	{
 		
 		private const System.String alphabet = "abcdefghijklmnopqrstuvwzyz";
 		private System.Random random;
 		
-		[SetUp]
-		public override void SetUp()
+		[Test]
+		public override void  SetUp()
 		{
 			base.SetUp();
-			random = new System.Random();
-			SupportClass.AppSettings.Get("Lucene.Net.FSDirectory.class", "Lucene.Net.Store.MMapDirectory");
+			random = NewRandom();
 		}
 		
 		private System.String RandomToken()
@@ -67,14 +66,14 @@
 			}
 			return fb.ToString();
 		}
-
+		
 		private static readonly System.String storePathname = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.AppSettings.Get("tempDir", ""), "testLuceneMmap")).FullName;
 		
 		[Test]
 		public virtual void  TestMmapIndex()
 		{
 			FSDirectory storeDirectory;
-			storeDirectory = FSDirectory.GetDirectory(storePathname);
+			storeDirectory = new MMapDirectory(new System.IO.FileInfo(storePathname), null);
 			
 			// plan to add a set of useful stopwords, consider changing some of the
 			// interior filters.

Modified: incubator/lucene.net/trunk/C#/src/Test/Store/_TestHelper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/_TestHelper.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/_TestHelper.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/_TestHelper.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -17,7 +17,9 @@
 
 using System;
 
-using FSIndexInput = Lucene.Net.Store.FSDirectory.FSIndexInput;
+using NUnit.Framework;
+
+using SimpleFSIndexInput = Lucene.Net.Store.SimpleFSDirectory.SimpleFSIndexInput;
 
 namespace Lucene.Net.Store
 {
@@ -29,21 +31,21 @@
 	{
 		
 		/// <summary>Returns true if the instance of the provided input stream is actually
-		/// an FSIndexInput.
+		/// an SimpleFSIndexInput.
 		/// </summary>
-		public static bool IsFSIndexInput(IndexInput is_Renamed)
+		public static bool IsSimpleFSIndexInput(IndexInput is_Renamed)
 		{
-			return is_Renamed is FSIndexInput;
+			return is_Renamed is SimpleFSIndexInput;
 		}
 		
-		/// <summary>Returns true if the provided input stream is an FSIndexInput and
+		/// <summary>Returns true if the provided input stream is an SimpleFSIndexInput and
 		/// is a clone, that is it does not own its underlying file descriptor.
 		/// </summary>
-		public static bool IsFSIndexInputClone(IndexInput is_Renamed)
+		public static bool IsSimpleFSIndexInputClone(IndexInput is_Renamed)
 		{
-			if (IsFSIndexInput(is_Renamed))
+			if (IsSimpleFSIndexInput(is_Renamed))
 			{
-				return ((FSIndexInput) is_Renamed).isClone_ForNUnitTest;
+				return ((SimpleFSIndexInput) is_Renamed).isClone_ForNUnit;
 			}
 			else
 			{
@@ -51,18 +53,18 @@
 			}
 		}
 		
-		/// <summary>Given an instance of FSDirectory.FSIndexInput, this method returns
+		/// <summary>Given an instance of SimpleFSDirectory.SimpleFSIndexInput, this method returns
 		/// true if the underlying file descriptor is valid, and false otherwise.
 		/// This can be used to determine if the OS file has been closed.
 		/// The descriptor becomes invalid when the non-clone instance of the
-		/// FSIndexInput that owns this descriptor is closed. However, the
+		/// SimpleFSIndexInput that owns this descriptor is closed. However, the
 		/// descriptor may possibly become invalid in other ways as well.
 		/// </summary>
-		public static bool IsFSIndexInputOpen(IndexInput is_Renamed)
+		public static bool IsSimpleFSIndexInputOpen(IndexInput is_Renamed)
 		{
-			if (IsFSIndexInput(is_Renamed))
+			if (IsSimpleFSIndexInput(is_Renamed))
 			{
-				FSIndexInput fis = (FSIndexInput) is_Renamed;
+				SimpleFSIndexInput fis = (SimpleFSIndexInput) is_Renamed;
 				return fis.IsFDValid();
 			}
 			else

Modified: incubator/lucene.net/trunk/C#/src/Test/Test.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test.csproj?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Test.csproj (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Test.csproj Tue Nov  3 18:06:27 2009
@@ -82,8 +82,14 @@
       <Name>Lucene.Net</Name>
       <HintPath>..\Lucene.Net\bin\Debug\Lucene.Net.dll</HintPath>
     </Reference>
-    <Reference Include="nunit.core, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
-    <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
+    <Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\NUnit.Net\NUnit-2.5.2.9222\bin\net-2.0\framework\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="nunit.mocks, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\NUnit.Net\NUnit-2.5.2.9222\bin\net-2.0\framework\nunit.mocks.dll</HintPath>
+    </Reference>
     <Reference Include="System">
       <Name>System</Name>
     </Reference>
@@ -98,15 +104,17 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="AnalysisTest.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="Analysis\TeeSinkTokenTest.cs" />
+    <Compile Include="Analysis\BaseTokenStreamTestCase.cs" />
+    <Compile Include="Analysis\Tokenattributes\TestSimpleAttributeImpls.cs" />
+    <Compile Include="Analysis\Tokenattributes\TestTermAttributeImpl.cs" />
     <Compile Include="Analysis\TestAnalyzers.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Analysis\TestASCIIFoldingFilter.cs" />
     <Compile Include="Analysis\TestCachingTokenFilter.cs" />
+    <Compile Include="Analysis\TestCharacterCache.cs" />
     <Compile Include="Analysis\TestCharArraySet.cs" />
+    <Compile Include="Analysis\TestCharFilter.cs" />
     <Compile Include="Analysis\TestISOLatin1AccentFilter.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -116,6 +124,8 @@
     <Compile Include="Analysis\TestLengthFilter.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Analysis\TestMappingCharFilter.cs" />
+    <Compile Include="Analysis\TestNumericTokenStream.cs" />
     <Compile Include="Analysis\TestPerFieldAnalzyerWrapper.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -128,7 +138,10 @@
     <Compile Include="Analysis\TestStopFilter.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Analysis\TestTeeSinkTokenFilter.cs" />
+    <Compile Include="Analysis\TestTeeTokenFilter.cs" />
     <Compile Include="Analysis\TestToken.cs" />
+    <Compile Include="Analysis\TestTokenStreamBWComp.cs" />
     <Compile Include="AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -136,21 +149,12 @@
     <Compile Include="Document\TestDateTools.cs" />
     <Compile Include="Document\TestDocument.cs" />
     <Compile Include="Document\TestNumberTools.cs" />
-    <Compile Include="IndexTest.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Index\DocHelper.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Index\DocTest.cs" />
     <Compile Include="Index\MockIndexInput.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Index\MockInputStream.cs" />
-    <Compile Include="Index\Store\TestRAMDirectory.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="Index\TermInfosTest.cs" />
     <Compile Include="Index\TestAddIndexesNoOptimize.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -160,13 +164,13 @@
     </Compile>
     <Compile Include="Index\TestByteSlices.cs" />
     <Compile Include="Index\TestCheckIndex.cs" />
-    <Compile Include="Index\TestCloseableThreadLocal.cs" />
     <Compile Include="Index\TestCompoundFile.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Index\TestConcurrentMergeScheduler.cs" />
     <Compile Include="Index\TestCrash.cs" />
     <Compile Include="Index\TestDeletionPolicy.cs" />
+    <Compile Include="Index\TestDirectoryReader.cs" />
     <Compile Include="Index\TestDoc.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -194,10 +198,10 @@
     <Compile Include="Index\TestIndexReader.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Index\TestIndexReaderClone.cs" />
+    <Compile Include="Index\TestIndexReaderCloneNorms.cs" />
     <Compile Include="Index\TestIndexReaderReopen.cs" />
-    <Compile Include="Index\TestIndexWriter.cs">
-      <SubType>Code</SubType>
-    </Compile>
+    <Compile Include="Index\TestIndexWriter.cs" />
     <Compile Include="Index\TestIndexWriterDelete.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -211,7 +215,7 @@
     <Compile Include="Index\TestIndexWriterMerging.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Index\TestInputStream.cs" />
+    <Compile Include="Index\TestIndexWriterReader.cs" />
     <Compile Include="Index\TestLazyBug.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -222,10 +226,10 @@
     <Compile Include="Index\TestMultiReader.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Index\TestMultiSegmentReader.cs" />
     <Compile Include="Index\TestNorms.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Index\TestNRTReaderWithThreads.cs" />
     <Compile Include="Index\TestOmitTf.cs" />
     <Compile Include="Index\TestParallelReader.cs">
       <SubType>Code</SubType>
@@ -258,10 +262,8 @@
     <Compile Include="Index\TestTermVectorsReader.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Index\TestTermVectorsWriter.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Index\TestThreadedOptimize.cs" />
+    <Compile Include="Index\TestTransactionRollback.cs" />
     <Compile Include="Index\TestTransactions.cs" />
     <Compile Include="Index\TestWordlistLoader.cs">
       <SubType>Code</SubType>
@@ -275,29 +277,30 @@
     <Compile Include="QueryParser\TestQueryParser.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="SearchTest.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="SearchTestForDuplicates.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\BaseTestRangeFilter.cs" />
     <Compile Include="Search\CachingWrapperFilterHelper.cs" />
     <Compile Include="Search\CheckHits.cs" />
     <Compile Include="Search\Function\FunctionTestSetup.cs" />
+    <Compile Include="Search\Function\JustCompileSearchSpans.cs" />
     <Compile Include="Search\Function\TestCustomScoreQuery.cs" />
+    <Compile Include="Search\Function\TestDocValues.cs" />
     <Compile Include="Search\Function\TestFieldScoreQuery.cs" />
     <Compile Include="Search\Function\TestOrdValues.cs" />
+    <Compile Include="Search\Function\TestValueSource.cs" />
+    <Compile Include="Search\JustCompileSearch.cs" />
     <Compile Include="Search\MockFilter.cs" />
     <Compile Include="Search\Payloads\PayloadHelper.cs" />
     <Compile Include="Search\Payloads\TestBoostingTermQuery.cs" />
+    <Compile Include="Search\Payloads\TestPayloadNearQuery.cs" />
+    <Compile Include="Search\Payloads\TestPayloadTermQuery.cs" />
     <Compile Include="Search\QueryUtils.cs" />
-    <Compile Include="Search\RemoteCachingWrapperFilterHelper.cs" />
     <Compile Include="Search\SampleComparable.cs" />
     <Compile Include="Search\SingleDocTestFilter.cs" />
+    <Compile Include="Search\Spans\JustCompileSearchSpans.cs" />
     <Compile Include="Search\Spans\TestBasics.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Search\Spans\TestFieldMaskingSpanQuery.cs" />
     <Compile Include="Search\Spans\TestNearSpansOrdered.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -326,14 +329,17 @@
     <Compile Include="Search\TestCachingWrapperFilter.cs" />
     <Compile Include="Search\TestComplexExplanations.cs" />
     <Compile Include="Search\TestComplexExplanationsOfNonMatches.cs" />
-    <Compile Include="Search\TestConstantScoreRangeQuery.cs" />
     <Compile Include="Search\TestCustomSearcherSort.cs" />
     <Compile Include="Search\TestDateFilter.cs" />
     <Compile Include="Search\TestDateSort.cs" />
     <Compile Include="Search\TestDisjunctionMaxQuery.cs" />
     <Compile Include="Search\TestDocBoost.cs" />
+    <Compile Include="Search\TestDocIdSet.cs" />
+    <Compile Include="Search\TestElevationComparator.cs" />
     <Compile Include="Search\TestExplanations.cs" />
-    <Compile Include="Search\TestExtendedFieldCache.cs" />
+    <Compile Include="Search\TestFieldCache.cs" />
+    <Compile Include="Search\TestFieldCacheRangeFilter.cs" />
+    <Compile Include="Search\TestFieldCacheTermsFilter.cs" />
     <Compile Include="Search\TestFilteredQuery.cs" />
     <Compile Include="Search\TestFilteredSearch.cs" />
     <Compile Include="Search\TestFuzzyQuery.cs" />
@@ -341,19 +347,22 @@
     <Compile Include="Search\TestMultiPhraseQuery.cs" />
     <Compile Include="Search\TestMultiSearcher.cs" />
     <Compile Include="Search\TestMultiSearcherRanking.cs" />
+    <Compile Include="Search\TestMultiTermConstantScore.cs" />
     <Compile Include="Search\TestMultiThreadTermVectors.cs" />
+    <Compile Include="Search\TestMultiValuedNumericRangeQuery.cs" />
     <Compile Include="Search\TestNot.cs" />
+    <Compile Include="Search\TestNumericRangeQuery32.cs" />
+    <Compile Include="Search\TestNumericRangeQuery64.cs" />
     <Compile Include="Search\TestParallelMultiSearcher.cs" />
     <Compile Include="Search\TestPhrasePrefixQuery.cs" />
     <Compile Include="Search\TestPhraseQuery.cs" />
     <Compile Include="Search\TestPositionIncrement.cs" />
+    <Compile Include="Search\TestPositiveScoresOnlyCollector.cs" />
     <Compile Include="Search\TestPrefixFilter.cs" />
     <Compile Include="Search\TestPrefixQuery.cs" />
     <Compile Include="Search\TestQueryTermVector.cs" />
-    <Compile Include="Search\TestRangeFilter.cs" />
-    <Compile Include="Search\TestRangeQuery.cs" />
-    <Compile Include="Search\TestRemoteCachingWrapperFilter.cs" />
-    <Compile Include="Search\TestRemoteSearchable.cs" />
+    <Compile Include="Search\TestQueryWrapperFilter.cs" />
+    <Compile Include="Search\TestScoreCachingWrappingScorer.cs" />
     <Compile Include="Search\TestScorerPerf.cs" />
     <Compile Include="Search\TestSearchHitsWithDeletions.cs" />
     <Compile Include="Search\TestSetNorm.cs" />
@@ -363,14 +372,17 @@
     <Compile Include="Search\TestSloppyPhraseQuery.cs" />
     <Compile Include="Search\TestSort.cs" />
     <Compile Include="Search\TestSpanQueryFilter.cs" />
+    <Compile Include="Search\TestStressSort.cs" />
+    <Compile Include="Search\TestTermRangeFilter.cs" />
+    <Compile Include="Search\TestTermRangeQuery.cs" />
     <Compile Include="Search\TestTermScorer.cs" />
     <Compile Include="Search\TestTermVectors.cs" />
     <Compile Include="Search\TestThreadSafe.cs" />
     <Compile Include="Search\TestTimeLimitedCollector.cs" />
+    <Compile Include="Search\TestTimeLimitingCollector.cs" />
+    <Compile Include="Search\TestTopDocsCollector.cs" />
+    <Compile Include="Search\TestTopScoreDocCollector.cs" />
     <Compile Include="Search\TestWildcard.cs" />
-    <Compile Include="StoreTest.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Store\MockRAMDirectory.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -382,6 +394,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Store\TestDirectory.cs" />
+    <Compile Include="Store\TestFileSwitchDirectory.cs" />
     <Compile Include="Store\TestHugeRamFile.cs" />
     <Compile Include="Store\TestLock.cs">
       <SubType>Code</SubType>
@@ -389,7 +402,7 @@
     <Compile Include="Store\TestLockFactory.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\TestMMapDirectory.cs" />
+    <Compile Include="Store\TestRAMDirectory.cs" />
     <Compile Include="Store\TestWindowsMMap.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -410,22 +423,26 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="TestSnapshotDeletionPolicy.cs" />
-    <Compile Include="ThreadSafetyTest.cs">
-      <SubType>Code</SubType>
-    </Compile>
+    <Compile Include="Util\ArrayUtilTest.cs" />
     <Compile Include="Util\Cache\TestSimpleLRUCache.cs" />
     <Compile Include="Util\English.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Util\LocalizedTestCase.cs" />
     <Compile Include="Util\LuceneTestCase.cs" />
-    <Compile Include="Util\StringHelperTest.cs" />
+    <Compile Include="Util\TestAttributeSource.cs" />
     <Compile Include="Util\TestBitVector.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Util\TestCloseableThreadLocal.cs" />
+    <Compile Include="Util\TestFieldCacheSanityChecker.cs" />
+    <Compile Include="Util\TestIndexableBinaryStringTools.cs" />
+    <Compile Include="Util\TestNumericUtils.cs" />
     <Compile Include="Util\TestOpenBitSet.cs" />
     <Compile Include="Util\TestPriorityQueue.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Util\TestRamUsageEstimator.cs" />
     <Compile Include="Util\TestSmallFloat.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -433,7 +450,7 @@
     <Compile Include="Util\TestStringHelper.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="TestSupportClass.cs" />
+    <Compile Include="Util\TestStringIntern.cs" />
     <Compile Include="Util\_TestUtil.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -448,6 +465,8 @@
     <None Include="Index\index.22.nocfs.zip" />
     <None Include="Index\index.23.cfs.zip" />
     <None Include="Index\index.23.nocfs.zip" />
+    <None Include="Index\index.24.cfs.zip" />
+    <None Include="Index\index.24.nocfs.zip" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>

Modified: incubator/lucene.net/trunk/C#/src/Test/Test.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test.sln?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Test.sln (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Test.sln Tue Nov  3 18:06:27 2009
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 9.00
 # Visual Studio 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test-VS2005", "Test-VS2005.csproj", "{AAF68BCF-F781-45FC-98B3-2B9CEE411E01}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test.csproj", "{AAF68BCF-F781-45FC-98B3-2B9CEE411E01}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution

Modified: incubator/lucene.net/trunk/C#/src/Test/TestDemo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/TestDemo.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/TestDemo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/TestDemo.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 using System;
 
 using NUnit.Framework;
@@ -25,45 +26,48 @@
 using IndexWriter = Lucene.Net.Index.IndexWriter;
 using ParseException = Lucene.Net.QueryParsers.ParseException;
 using QueryParser = Lucene.Net.QueryParsers.QueryParser;
+using Directory = Lucene.Net.Store.Directory;
+using RAMDirectory = Lucene.Net.Store.RAMDirectory;
+using Version = Lucene.Net.Util.Version;
 using IndexSearcher = Lucene.Net.Search.IndexSearcher;
 using Query = Lucene.Net.Search.Query;
 using ScoreDoc = Lucene.Net.Search.ScoreDoc;
-using Directory = Lucene.Net.Store.Directory;
-using RAMDirectory = Lucene.Net.Store.RAMDirectory;
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 using _TestUtil = Lucene.Net.Util._TestUtil;
 
 namespace Lucene.Net
 {
+	
 	/// <summary> A very simple demo used in the API documentation (src/java/overview.html).
+	/// 
+	/// Please try to keep src/java/overview.html up-to-date when making changes
+	/// to this class.
 	/// </summary>
 	[TestFixture]
-	public class TestDemo : LuceneTestCase
+	public class TestDemo:LuceneTestCase
 	{
+		
 		[Test]
-		public virtual void  TestDemo_Renamed_Method()
+		public virtual void  TestDemo_Renamed()
 		{
-			Analyzer analyzer = new StandardAnalyzer();
+			
+			Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
 			
 			// Store the index in memory:
 			Directory directory = new RAMDirectory();
-			// To store an index on disk, use this instead (note that the 
-			// parameter true will overwrite the index in that directory
-			// if one exists):
-			//Directory directory = FSDirectory.getDirectory("/tmp/testindex", true);
+			// To store an index on disk, use this instead:
+			//Directory directory = FSDirectory.open("/tmp/testindex");
 			IndexWriter iwriter = new IndexWriter(directory, analyzer, true, new IndexWriter.MaxFieldLength(25000));
 			Document doc = new Document();
 			System.String text = "This is the text to be indexed.";
 			doc.Add(new Field("fieldname", text, Field.Store.YES, Field.Index.ANALYZED));
 			iwriter.AddDocument(doc);
 			iwriter.Close();
-
-            _TestUtil.CheckIndex(directory);
-
+			
 			// Now search the index:
-			IndexSearcher isearcher = new IndexSearcher(directory);
+			IndexSearcher isearcher = new IndexSearcher(directory, true); // read-only=true
 			// Parse a simple query that searches for "text":
-			Lucene.Net.QueryParsers.QueryParser parser = new Lucene.Net.QueryParsers.QueryParser("fieldname", analyzer);
+			QueryParser parser = new QueryParser("fieldname", analyzer);
 			Query query = parser.Parse("text");
 			ScoreDoc[] hits = isearcher.Search(query, null, 1000).scoreDocs;
 			Assert.AreEqual(1, hits.Length);
@@ -71,7 +75,7 @@
 			for (int i = 0; i < hits.Length; i++)
 			{
 				Document hitDoc = isearcher.Doc(hits[i].doc);
-				Assert.AreEqual("This is the text to be indexed.", hitDoc.Get("fieldname"));
+				Assert.AreEqual(hitDoc.Get("fieldname"), "This is the text to be indexed.");
 			}
 			isearcher.Close();
 			directory.Close();

Modified: incubator/lucene.net/trunk/C#/src/Test/TestHitIterator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/TestHitIterator.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/TestHitIterator.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/TestHitIterator.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -18,30 +18,30 @@
 
 using NUnit.Framework;
 
+using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
 using Document = Lucene.Net.Documents.Document;
 using Field = Lucene.Net.Documents.Field;
 using IndexWriter = Lucene.Net.Index.IndexWriter;
 using Term = Lucene.Net.Index.Term;
 using RAMDirectory = Lucene.Net.Store.RAMDirectory;
-using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
 using Hit = Lucene.Net.Search.Hit;
-using Hits = Lucene.Net.Search.Hits;
 using HitIterator = Lucene.Net.Search.HitIterator;
-using ScoreDoc = Lucene.Net.Search.ScoreDoc;
+using Hits = Lucene.Net.Search.Hits;
 using IndexSearcher = Lucene.Net.Search.IndexSearcher;
 using TermQuery = Lucene.Net.Search.TermQuery;
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 using _TestUtil = Lucene.Net.Util._TestUtil;
-
 namespace Lucene.Net
 {
 	
 	/// <summary> This test intentionally not put in the search package in order
 	/// to test HitIterator and Hit package protection.
+	/// 
 	/// </summary>
-    [System.Obsolete("Hits will be removed in Lucene 3.0.")]
-    [TestFixture]
-	public class TestHitIterator : LuceneTestCase
+	/// <deprecated> Hits will be removed in Lucene 3.0 
+	/// </deprecated>
+	[TestFixture]
+	public class TestHitIterator:LuceneTestCase
 	{
 		[Test]
 		public virtual void  TestIterator()
@@ -49,18 +49,18 @@
 			RAMDirectory directory = new RAMDirectory();
 			
 			IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-			Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
+			Document doc = new Document();
 			doc.Add(new Field("field", "iterator test doc 1", Field.Store.YES, Field.Index.ANALYZED));
 			writer.AddDocument(doc);
 			
-			doc = new Lucene.Net.Documents.Document();
+			doc = new Document();
 			doc.Add(new Field("field", "iterator test doc 2", Field.Store.YES, Field.Index.ANALYZED));
 			writer.AddDocument(doc);
 			
 			writer.Close();
-
-            _TestUtil.CheckIndex(directory);
-
+			
+			_TestUtil.CheckIndex(directory);
+			
 			IndexSearcher searcher = new IndexSearcher(directory);
 			Hits hits = searcher.Search(new TermQuery(new Term("field", "iterator")));
 			
@@ -81,7 +81,7 @@
 			{
 				System.Object generatedAux = iterator.Current;
 			}
-			catch (System.ArgumentOutOfRangeException)
+			catch (System.ArgumentOutOfRangeException e)
 			{
 				Assert.IsTrue(true);
 				caughtException = true;

Modified: incubator/lucene.net/trunk/C#/src/Test/TestMergeSchedulerExternal.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/TestMergeSchedulerExternal.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/TestMergeSchedulerExternal.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/TestMergeSchedulerExternal.cs Tue Nov  3 18:06:27 2009
@@ -1,13 +1,13 @@
-/**
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,122 +15,162 @@
  * limitations under the License.
  */
 
+using System;
+
 using NUnit.Framework;
 
-using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
-using MockRAMDirectory = Lucene.Net.Store.MockRAMDirectory;
-using Directory = Lucene.Net.Store.Directory;
-using IndexWriter = Lucene.Net.Index.IndexWriter;
-using MergePolicy = Lucene.Net.Index.MergePolicy;
-using ConcurrentMergeScheduler = Lucene.Net.Index.ConcurrentMergeScheduler;
 using Document = Lucene.Net.Documents.Document;
 using Field = Lucene.Net.Documents.Field;
+using ConcurrentMergeScheduler = Lucene.Net.Index.ConcurrentMergeScheduler;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using MergePolicy = Lucene.Net.Index.MergePolicy;
+using Directory = Lucene.Net.Store.Directory;
+using MockRAMDirectory = Lucene.Net.Store.MockRAMDirectory;
+using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 
-namespace Lucene.Net.Test
+namespace Lucene.Net
 {
-    /**
-     * Holds tests cases to verify external APIs are accessible
-     * while not being in org.apache.lucene.index package.
-     */
-    [TestFixture]
-    public class TestMergeSchedulerExternal : LuceneTestCase
-    {
-
-        internal volatile bool mergeCalled;
-        internal volatile bool mergeThreadCreated;
-        internal volatile bool excCalled;
-
-        private class MyMergeException : System.Exception
-        {
-            Directory dir;
-            public MyMergeException(System.Exception exc, Directory dir)
-                : base(null, exc)
-            {
-                this.dir = dir;
-            }
-        }
-
-        private class MyMergeScheduler : ConcurrentMergeScheduler
-        {
-
-            internal TestMergeSchedulerExternal enclosingInstance;
-
-            public MyMergeScheduler(TestMergeSchedulerExternal enclosingInstance)
-                : base()
-            {
-                this.enclosingInstance = enclosingInstance;
-            }
-
-            private class MyMergeThread : ConcurrentMergeScheduler.MergeThread
-            {
-                public MyMergeThread(ConcurrentMergeScheduler scheduler, IndexWriter writer, MergePolicy.OneMerge merge)
-                    : base(scheduler, writer, merge)
-                {
-                    ((MyMergeScheduler)scheduler).enclosingInstance.mergeThreadCreated = true;
-                }
-            }
-
-            override protected MergeThread GetMergeThread(IndexWriter writer, MergePolicy.OneMerge merge)
-            {
-                MergeThread thread = new MyMergeThread(this, writer, merge);
-                thread.SetThreadPriority(GetMergeThreadPriority());
-                thread.IsBackground = true;
-                thread.Name = "MyMergeThread";
-                return thread;
-            }
-
-            override protected void HandleMergeException(System.Exception t)
-            {
-                enclosingInstance.excCalled = true;
-            }
-
-            override protected void DoMerge(MergePolicy.OneMerge merge)
-            {
-                enclosingInstance.mergeCalled = true;
-                base.DoMerge(merge);
-            }
-        }
-
-        private class FailOnlyOnMerge : MockRAMDirectory.Failure
-        {
-            override public void Eval(MockRAMDirectory dir)
-            {
-                System.Diagnostics.StackFrame[] frames = new System.Diagnostics.StackTrace().GetFrames();
-                for (int i = 0; i < frames.Length; i++)
-                {
-                    if ("DoMerge".Equals(frames[i].GetMethod().Name))
-                        throw new System.IO.IOException("now failing during merge");
-                }
-            }
-        }
-
-        [Test]
-        public void TestSubclassConcurrentMergeScheduler()
-        {
-            MockRAMDirectory dir = new MockRAMDirectory();
-            dir.FailOn(new FailOnlyOnMerge());
-
-            Document doc = new Document();
-            Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
-            doc.Add(idField);
-
-            IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-            MyMergeScheduler ms = new MyMergeScheduler(this);
-            writer.SetMergeScheduler(ms);
-            writer.SetMaxBufferedDocs(2);
-            writer.SetRAMBufferSizeMB(IndexWriter.DISABLE_AUTO_FLUSH);
-            for (int i = 0; i < 20; i++)
-                writer.AddDocument(doc);
-
-            ms.Sync();
-            writer.Close();
-
-            Assert.IsTrue(mergeThreadCreated);
-            Assert.IsTrue(mergeCalled);
-            Assert.IsTrue(excCalled);
-            dir.Close();
-            Assert.IsTrue(ConcurrentMergeScheduler.AnyUnhandledExceptions());
-        }
-    }
-}
+	
+	
+	/// <summary> Holds tests cases to verify external APIs are accessible
+	/// while not being in Lucene.Net.Index package.
+	/// </summary>
+	[TestFixture]
+	public class TestMergeSchedulerExternal:LuceneTestCase
+	{
+		
+		internal volatile bool mergeCalled;
+		internal volatile bool mergeThreadCreated;
+		internal volatile bool excCalled;
+		
+		[Serializable]
+		private class MyMergeException:System.SystemException
+		{
+			private void  InitBlock(TestMergeSchedulerExternal enclosingInstance)
+			{
+				this.enclosingInstance = enclosingInstance;
+			}
+			private TestMergeSchedulerExternal enclosingInstance;
+			public TestMergeSchedulerExternal Enclosing_Instance
+			{
+				get
+				{
+					return enclosingInstance;
+				}
+				
+			}
+			internal Directory dir;
+			public MyMergeException(TestMergeSchedulerExternal enclosingInstance, System.Exception exc, Directory dir):base("", exc)
+			{
+				InitBlock(enclosingInstance);
+				this.dir = dir;
+			}
+		}
+		
+		private class MyMergeScheduler:ConcurrentMergeScheduler
+		{
+			public MyMergeScheduler(TestMergeSchedulerExternal enclosingInstance)
+			{
+				InitBlock(enclosingInstance);
+			}
+			private void  InitBlock(TestMergeSchedulerExternal enclosingInstance)
+			{
+				this.enclosingInstance = enclosingInstance;
+			}
+			private TestMergeSchedulerExternal enclosingInstance;
+			public TestMergeSchedulerExternal Enclosing_Instance
+			{
+				get
+				{
+					return enclosingInstance;
+				}
+				
+			}
+			
+			private class MyMergeThread:ConcurrentMergeScheduler.MergeThread
+			{
+				private void  InitBlock(MyMergeScheduler enclosingInstance)
+				{
+					this.enclosingInstance = enclosingInstance;
+				}
+				private MyMergeScheduler enclosingInstance;
+				public new MyMergeScheduler Enclosing_Instance
+				{
+					get
+					{
+						return enclosingInstance;
+					}
+					
+				}
+				public MyMergeThread(MyMergeScheduler enclosingInstance, IndexWriter writer, MergePolicy.OneMerge merge):base(enclosingInstance, writer, merge)
+				{
+					InitBlock(enclosingInstance);
+					Enclosing_Instance.Enclosing_Instance.mergeThreadCreated = true;
+				}
+			}
+			
+			protected /*internal*/ override MergeThread GetMergeThread(IndexWriter writer, MergePolicy.OneMerge merge)
+			{
+				MergeThread thread = new MyMergeThread(this, writer, merge);
+				thread.SetThreadPriority(GetMergeThreadPriority());
+				thread.IsBackground = true;
+				thread.Name = "MyMergeThread";
+				return thread;
+			}
+			
+			protected /*internal*/ override void  HandleMergeException(System.Exception t)
+			{
+				Enclosing_Instance.excCalled = true;
+			}
+			
+			protected /*internal*/ override void  DoMerge(MergePolicy.OneMerge merge)
+			{
+				Enclosing_Instance.mergeCalled = true;
+				base.DoMerge(merge);
+			}
+		}
+		
+		private class FailOnlyOnMerge:MockRAMDirectory.Failure
+		{
+			public override /*virtual*/ void  Eval(MockRAMDirectory dir)
+			{
+                System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace();
+				for (int i = 0; i < trace.FrameCount; i++)
+				{
+                    System.Diagnostics.StackFrame sf = trace.GetFrame(i);
+					if ("DoMerge".Equals(sf.GetMethod()))
+						throw new System.IO.IOException("now failing during merge");
+				}
+			}
+		}
+		
+		[Test]
+		public virtual void  TestSubclassConcurrentMergeScheduler()
+		{
+			MockRAMDirectory dir = new MockRAMDirectory();
+			dir.FailOn(new FailOnlyOnMerge());
+			
+			Document doc = new Document();
+			Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
+			doc.Add(idField);
+			
+			IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
+			MyMergeScheduler ms = new MyMergeScheduler(this);
+			writer.SetMergeScheduler(ms);
+			writer.SetMaxBufferedDocs(2);
+			writer.SetRAMBufferSizeMB(Lucene.Net.Index.IndexWriter.DISABLE_AUTO_FLUSH);
+			for (int i = 0; i < 20; i++)
+				writer.AddDocument(doc);
+			
+			ms.Sync();
+			writer.Close();
+			
+			Assert.IsTrue(mergeThreadCreated);
+			Assert.IsTrue(mergeCalled);
+			Assert.IsTrue(excCalled);
+			dir.Close();
+			Assert.IsTrue(ConcurrentMergeScheduler.AnyUnhandledExceptions());
+		}
+	}
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/TestSearch.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/TestSearch.cs?rev=832486&r1=832485&r2=832486&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/TestSearch.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/TestSearch.cs Tue Nov  3 18:06:27 2009
@@ -1,4 +1,4 @@
-/*
+/* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -19,13 +19,12 @@
 
 using NUnit.Framework;
 
+using Lucene.Net.Analysis;
 using Lucene.Net.Documents;
 using Lucene.Net.Index;
 using Lucene.Net.QueryParsers;
 using Lucene.Net.Store;
-using Lucene.Net.Analysis;
 using Lucene.Net.Search;
-using Searchable = Lucene.Net.Search.Searchable;
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 
 namespace Lucene.Net
@@ -34,17 +33,17 @@
 	/// <summary>JUnit adaptation of an older test case SearchTest.
 	/// 
 	/// </summary>
-	/// <version>  $Id: TestSearch.java 583534 2007-10-10 16:46:35Z mikemccand $
+	/// <version>  $Id: TestSearch.java 694004 2008-09-10 21:38:52Z mikemccand $
 	/// </version>
 	[TestFixture]
-	public class TestSearch : LuceneTestCase
+	public class TestSearch:LuceneTestCase
 	{
 		
 		/// <summary>Main for running test case by itself. </summary>
 		[STAThread]
 		public static void  Main(System.String[] args)
 		{
-			// NUnit.Core.TestRunner.Run(new NUnit.Core.TestSuite(typeof(TestSearch))); // {{Aroush-1.9}} where is 'TestRunner' in NUnit?
+			// TestRunner.run(new TestSuite(typeof(TestSearch))); // {{Aroush-2.9}} how is this done in NUnit?
 		}
 		
 		/// <summary>This test performs a number of searches. It also compares output
@@ -56,8 +55,8 @@
 		/// passes if the results are the same between multi-file and
 		/// single-file formats, even if the results are wrong.
 		/// </summary>
-		[Test]
-		public virtual void  TestSearch_Renamed_Method()
+        [Test]
+        public virtual void TestSearch_Renamed()
 		{
 			System.IO.MemoryStream sw = new System.IO.MemoryStream();
 			System.IO.StreamWriter pw = new System.IO.StreamWriter(sw);
@@ -89,7 +88,7 @@
 			System.String[] docs = new System.String[]{"a b c d e", "a b c d e a b c d e", "a b c d e f g h i j", "a c e", "e c a", "a c e a c e", "a c e a b c"};
 			for (int j = 0; j < docs.Length; j++)
 			{
-				Lucene.Net.Documents.Document d = new Lucene.Net.Documents.Document();
+				Document d = new Document();
 				d.Add(new Field("contents", docs[j], Field.Store.YES, Field.Index.ANALYZED));
 				writer.AddDocument(d);
 			}
@@ -100,7 +99,7 @@
 			System.String[] queries = new System.String[]{"a b", "\"a b\"", "\"a b c\"", "a c", "\"a c\"", "\"a c e\""};
 			ScoreDoc[] hits = null;
 			
-			Lucene.Net.QueryParsers.QueryParser parser = new Lucene.Net.QueryParsers.QueryParser("contents", analyzer);
+			QueryParser parser = new QueryParser("contents", analyzer);
 			parser.SetPhraseSlop(4);
 			for (int j = 0; j < queries.Length; j++)
 			{
@@ -117,7 +116,7 @@
 				out_Renamed.WriteLine(hits.Length + " total results");
 				for (int i = 0; i < hits.Length && i < 10; i++)
 				{
-					Lucene.Net.Documents.Document d = searcher.Doc(hits[i].doc);
+					Document d = searcher.Doc(hits[i].doc);
 					out_Renamed.WriteLine(i + " " + hits[i].score + " " + d.Get("contents"));
 				}
 			}



Mime
View raw message