//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void dropShouldDeleteEntireIndexFolder()
        public virtual void DropShouldDeleteEntireIndexFolder()
        {
            // given
            File root = Storage.directory().directory("root");
            IndexDirectoryStructure directoryStructure = IndexDirectoryStructure.directoriesByProvider(root).forProvider(GenericNativeIndexProvider.Descriptor);
            long indexId                    = 8;
            File indexDirectory             = directoryStructure.DirectoryForIndex(indexId);
            StoreIndexDescriptor descriptor = IndexDescriptorFactory.forSchema(SchemaDescriptorFactory.forLabel(1, 1)).withId(indexId);
            IndexSpecificSpaceFillingCurveSettingsCache spatialSettings = mock(typeof(IndexSpecificSpaceFillingCurveSettingsCache));
            PageCache             pageCache        = Storage.pageCache();
            FileSystemAbstraction fs               = Storage.fileSystem();
            File          indexFile                = new File(indexDirectory, "my-index");
            GenericLayout layout                   = new GenericLayout(1, spatialSettings);
            RecoveryCleanupWorkCollector immediate = immediate();
            IndexDropAction             dropAction = new FileSystemIndexDropAction(fs, directoryStructure);
            GenericNativeIndexPopulator populator  = new GenericNativeIndexPopulator(pageCache, fs, indexFile, layout, EMPTY, descriptor, spatialSettings, directoryStructure, mock(typeof(SpaceFillingCurveConfiguration)), dropAction, false);

            populator.Create();

            // when
            assertTrue(fs.ListFiles(indexDirectory).Length > 0);
            populator.Drop();

            // then
            assertFalse(fs.FileExists(indexDirectory));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            DefaultFileSystemAbstraction fs = this._fs.get();
            PageCache     pc     = _pageCacheRule.getPageCache(fs);
            File          file   = _directory.file("index");
            GenericLayout layout = new GenericLayout(1, _indexSettings);
            RecoveryCleanupWorkCollector collector = RecoveryCleanupWorkCollector.ignore();

            _descriptor = TestIndexDescriptorFactory.forLabel(1, 1).withId(1);
            IndexDirectoryStructure.Factory factory   = IndexDirectoryStructure.directoriesByProvider(_directory.storeDir());
            IndexDirectoryStructure         structure = factory.ForProvider(GenericNativeIndexProvider.Descriptor);
            IndexDropAction dropAction = new FileSystemIndexDropAction(fs, structure);

            _accessor = new GenericNativeIndexAccessor(pc, fs, file, layout, collector, EMPTY, _descriptor, _indexSettings, new StandardConfiguration(), dropAction, false);
        }