示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void snapshotForPartitionedIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SnapshotForPartitionedIndex()
        {
            // Given
            using (LuceneIndexAccessor indexAccessor = CreateDefaultIndexAccessor())
            {
                GenerateUpdates(indexAccessor, 32);
                indexAccessor.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);

                // When & Then
                IList <string> singlePartitionFileTemplates = Arrays.asList(".cfe", ".cfs", ".si", "segments_1");
                using (ResourceIterator <File> snapshotIterator = indexAccessor.SnapshotFiles())
                {
                    IList <string> indexFileNames = AsFileInsidePartitionNames(snapshotIterator);

                    assertTrue(indexFileNames.Count >= (singlePartitionFileTemplates.Count * 4), "Expect files from 4 partitions");
                    IDictionary <string, int> templateMatches = CountTemplateMatches(singlePartitionFileTemplates, indexFileNames);

                    foreach (string fileTemplate in singlePartitionFileTemplates)
                    {
                        int?matches = templateMatches[fileTemplate];
                        assertTrue(matches >= 4, "Expect to see at least 4 matches for template: " + fileTemplate);
                    }
                }
            }
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void snapshotForIndexWithNoCommits() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SnapshotForIndexWithNoCommits()
        {
            // Given
            // A completely un-used index
            using (LuceneIndexAccessor indexAccessor = CreateDefaultIndexAccessor(), ResourceIterator <File> snapshotIterator = indexAccessor.SnapshotFiles())
            {
                assertThat(AsUniqueSetOfNames(snapshotIterator), equalTo(emptySet()));
            }
        }