Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void openClosePartitionedIndex() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void OpenClosePartitionedIndex()
        {
            SchemaIndex reopenIndex = null;

            try
            {
                reopenIndex = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(new File(_testDir.directory("reopenIndexFolder"), "reopenIndex")).build();
                reopenIndex.open();

                AddDocumentToIndex(reopenIndex, 1);

                reopenIndex.close();
                assertFalse(reopenIndex.Open);

                reopenIndex.open();
                assertTrue(reopenIndex.Open);

                AddDocumentToIndex(reopenIndex, 10);

                reopenIndex.close();
                assertFalse(reopenIndex.Open);

                reopenIndex.open();
                assertTrue(reopenIndex.Open);

                reopenIndex.close();
                reopenIndex.open();
                AddDocumentToIndex(reopenIndex, 100);

                reopenIndex.maybeRefreshBlocking();

                using (LuceneAllDocumentsReader allDocumentsReader = reopenIndex.allDocumentsReader())
                {
                    assertEquals(111, allDocumentsReader.MaxCount(), "All documents should be visible");
                }
            }
            finally
            {
                if (reopenIndex != null)
                {
                    reopenIndex.close();
                }
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void markAsOnlineAndClose() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MarkAsOnlineAndClose()
        {
            _index = CreateIndex();
            _index.IndexWriter.addDocument(NewDocument());
            _index.markAsOnline();

            _index.close();

            _index = OpenIndex();
            assertTrue(_index.Online, "Should have had online status set");
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @After public void tearDown() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TearDown()
        {
            _index.close();
        }