//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGetDistinctStringValues() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGetDistinctStringValues() { // given LuceneIndexWriter writer = _index.IndexWriter; IDictionary <Value, MutableInt> expectedCounts = new Dictionary <Value, MutableInt>(); for (int i = 0; i < 10_000; i++) { Value value = stringValue(Random.Next(1_000).ToString()); writer.AddDocument(documentRepresentingProperties(i, value)); expectedCounts.computeIfAbsent(value, v => new MutableInt(0)).increment(); } _index.maybeRefreshBlocking(); // when/then GatheringNodeValueClient client = new GatheringNodeValueClient(); NodePropertyAccessor propertyAccessor = mock(typeof(NodePropertyAccessor)); using (IndexReader reader = _index.IndexReader) { reader.DistinctValues(client, propertyAccessor, true); while (client.Progressor.next()) { Value value = client.Values[0]; MutableInt expectedCount = expectedCounts.Remove(value); assertNotNull(expectedCount); assertEquals(expectedCount.intValue(), client.Reference); } assertTrue(expectedCounts.Count == 0); } verifyNoMoreInteractions(propertyAccessor); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void updateMultiplePartitionedIndex() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void UpdateMultiplePartitionedIndex() { using (SchemaIndex index = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(_testDir.directory("partitionedIndexForUpdates")).build()) { index.create(); index.open(); AddDocumentToIndex(index, 45); index.IndexWriter.updateDocument(LuceneDocumentStructure.NewTermForChangeOrRemove(100), LuceneDocumentStructure.DocumentRepresentingProperties(( long )100, Values.intValue(100))); index.maybeRefreshBlocking(); long documentsInIndex = Iterators.count(index.allDocumentsReader().GetEnumerator()); assertEquals(46, documentsInIndex, "Index should contain 45 added and 1 updated document."); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void addUpdates() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AddUpdates() { _populator = NewPopulator(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<org.neo4j.kernel.api.index.IndexEntryUpdate<?>> updates = java.util.Arrays.asList(add(1, schemaDescriptor, "aaa"), add(2, schemaDescriptor, "bbb"), add(3, schemaDescriptor, "ccc")); IList <IndexEntryUpdate <object> > updates = Arrays.asList(add(1, _schemaDescriptor, "aaa"), add(2, _schemaDescriptor, "bbb"), add(3, _schemaDescriptor, "ccc")); _populator.add(updates); _index.maybeRefreshBlocking(); using (IndexReader reader = _index.IndexReader) { LongIterator allEntities = reader.Query(IndexQuery.exists(1)); assertArrayEquals(new long[] { 1, 2, 3 }, PrimitiveLongCollections.asArray(allEntities)); } }
//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(); } } }