Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void createIndexStorage()
        internal virtual void CreateIndexStorage()
        {
            _storage = new PartitionedIndexStorage(_directoryFactory, _fs, _testDir.databaseDir());
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldListIndexPartitionsSorted() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldListIndexPartitionsSorted()
        {
            // GIVEN
            try (FileSystemAbstraction scramblingFs = new DefaultFileSystemAbstractionAnonymousInnerClass(this)){ PartitionedIndexStorage myStorage = new PartitionedIndexStorage(_directoryFactory, scramblingFs, _testDir.databaseDir());
                                                                                                                  File parent         = myStorage.IndexFolder;
                                                                                                                  int  directoryCount = 10;
                                                                                                                  for (int i = 0; i < directoryCount; i++)
                                                                                                                  {
                                                                                                                      scramblingFs.mkdirs(new File(parent, (i + 1).ToString()));
                                                                                                                  }

                                                                                                                  // WHEN
                                                                                                                  IDictionary <File, Directory> directories = myStorage.openIndexDirectories();

                                                                                                                  // THEN
                                                                                                                  assertEquals(directoryCount, directories.Count);
                                                                                                                  int previous = 0;
                                                                                                                  foreach (KeyValuePair <File, Directory> directory in directories.SetOfKeyValuePairs())
                                                                                                                  {
                                                                                                                      int current = parseInt(directory.Key.Name);
                                                                                                                      assertTrue(current > previous, "Wanted directory " + current + " to have higher id than previous " + previous);
                                                                                                                      previous = current;
                                                                                                                  }
                }