예제 #1
0
        public virtual void  TearDown()
        {
            try
            {
                // this isn't as useful as calling directly from the scope where the
                // index readers are used, because they could be gc'ed just before
                // tearDown is called.
                // But it's better then nothing.
                AssertSaneFieldCaches(GetTestLabel());

                if (ConcurrentMergeScheduler.AnyUnhandledExceptions())
                {
                    // Clear the failure so that we don't just keep
                    // failing subsequent test cases
                    ConcurrentMergeScheduler.ClearUnhandledExceptions();
                    Assert.Fail("ConcurrentMergeScheduler hit unhandled exceptions");
                }
            }
            finally
            {
                PurgeFieldCache(Lucene.Net.Search.FieldCache_Fields.DEFAULT);
            }

            TokenStream.SetOnlyUseNewAPI(savedAPISetting);
            //base.TearDown();  // {{Aroush-2.9}}
            this.seed_init = false;

            //{{Lucene.Net-2.9.1}}
            Lucene.Net.Search.BooleanQuery.SetAllowDocsOutOfOrder(allowDocsOutOfOrder);
        }
        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());
        }
예제 #3
0
        public virtual void  TearDown()
        {
            try
            {
                // this isn't as useful as calling directly from the scope where the
                // index readers are used, because they could be gc'ed just before
                // tearDown is called.
                // But it's better then nothing.
                AssertSaneFieldCaches(GetTestLabel());

                if (ConcurrentMergeScheduler.AnyUnhandledExceptions())
                {
                    // Clear the failure so that we don't just keep
                    // failing subsequent test cases
                    ConcurrentMergeScheduler.ClearUnhandledExceptions();
                    Assert.Fail("ConcurrentMergeScheduler hit unhandled exceptions");
                }
            }
            finally
            {
                PurgeFieldCache(Lucene.Net.Search.FieldCache_Fields.DEFAULT);
            }

            //base.TearDown();  // {{Aroush-2.9}}
            this.seed = null;
        }