//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: org.neo4j.graphdb.Resource gatherExplicitIndexFiles(java.util.Collection<org.neo4j.storageengine.api.StoreFileMetadata> files) throws java.io.IOException
        internal virtual Resource GatherExplicitIndexFiles(ICollection <StoreFileMetadata> files)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Collection<org.neo4j.graphdb.ResourceIterator<java.io.File>> snapshots = new java.util.ArrayList<>();
            ICollection <ResourceIterator <File> > snapshots = new List <ResourceIterator <File> >();

            foreach (IndexImplementation indexProvider in _explicitIndexProviders.allIndexProviders())
            {
                ResourceIterator <File> snapshot = indexProvider.ListStoreFiles();
                snapshots.Add(snapshot);
                GetSnapshotFilesMetadata(snapshot, files);
            }
            // Intentionally don't close the snapshot here, return it for closing by the consumer of
            // the targetFiles list.
            return(new MultiResource(snapshots));
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldCountAllIndexFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldCountAllIndexFiles()
        {
            // Explicit index file
            File explicitIndex = _testDirectory.databaseLayout().file("explicitIndex");

            CreateFileOfSize(explicitIndex, 1);

            IndexImplementation indexImplementation = mock(typeof(IndexImplementation));

            when(indexImplementation.GetIndexImplementationDirectory(any())).thenReturn(explicitIndex);
            when(_explicitIndexProviderLookup.allIndexProviders()).thenReturn(iterable(indexImplementation));

            // Schema index files
            File schemaIndex = _testDirectory.databaseLayout().file("schemaIndex");

            CreateFileOfSize(schemaIndex, 2);
            IndexDirectoryStructure directoryStructure = mock(typeof(IndexDirectoryStructure));

            when(directoryStructure.RootDirectory()).thenReturn(schemaIndex);
            when(_indexProvider.directoryStructure()).thenReturn(directoryStructure);

            File schemaIndex2 = _testDirectory.databaseLayout().file("schemaIndex2");

            CreateFileOfSize(schemaIndex2, 3);
            IndexDirectoryStructure directoryStructure2 = mock(typeof(IndexDirectoryStructure));

            when(directoryStructure2.RootDirectory()).thenReturn(schemaIndex2);
            when(_indexProvider2.directoryStructure()).thenReturn(directoryStructure2);

            // Label scan store
            File labelScan = _testDirectory.databaseLayout().labelScanStore();

            CreateFileOfSize(labelScan, 4);
            when(_labelScanStore.LabelScanStoreFile).thenReturn(labelScan);

            // Count all files
            assertEquals(10, _storeSizeBean.IndexStoreSize);
        }