Пример #1
0
		public virtual void  TestImmediateDiskFull()
		{
			MockRAMDirectory dir = new MockRAMDirectory();
			IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer());
			dir.SetMaxSizeInBytes(dir.GetRecomputedActualSizeInBytes());
			writer.SetMaxBufferedDocs(2);
			Document doc = new Document();
			doc.Add(new Field("field", "aaa bbb ccc ddd eee fff ggg hhh iii jjj", Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
			try
			{
				writer.AddDocument(doc);
				Assert.Fail("did not hit disk full");
			}
			catch (System.IO.IOException)
			{
			}
			// Without fix for LUCENE-1130: this call will hang:
			try
			{
				writer.AddDocument(doc);
				Assert.Fail("did not hit disk full");
			}
			catch (System.IO.IOException)
			{
			}
			try
			{
				writer.Close(false);
				Assert.Fail("did not hit disk full");
			}
			catch (System.IO.IOException)
			{
			}
		}