//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createEmptyIndex(org.neo4j.storageengine.api.schema.StoreIndexDescriptor schemaIndexDescriptor, SpatialIndexProvider provider) throws java.io.IOException
        private void CreateEmptyIndex(StoreIndexDescriptor schemaIndexDescriptor, SpatialIndexProvider provider)
        {
            IndexPopulator populator = provider.GetPopulator(schemaIndexDescriptor, SamplingConfig(), heapBufferFactory(1024));

            populator.Create();
            populator.Close(true);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAddToSpatialIndexWithModifiedSettings() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAddToSpatialIndexWithModifiedSettings()
        {
            // given
            SpatialIndexProvider provider = NewSpatialIndexProvider(_config2);

            AddUpdates(provider, _schemaIndexDescriptor2, _layoutUtil2);

            // then
            VerifySpatialSettings(IndexFile(_indexId2), _configuredSettings2.forCRS(_crs));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAddToSpatialIndexWithDefaults() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAddToSpatialIndexWithDefaults()
        {
            // given
            SpatialIndexProvider provider = NewSpatialIndexProvider(_config1);

            AddUpdates(provider, _schemaIndexDescriptor1, _layoutUtil1);

            // then
            VerifySpatialSettings(IndexFile(_indexId1), _configuredSettings1.forCRS(_crs));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAddToTwoDifferentIndexesOneDefaultAndOneModified() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAddToTwoDifferentIndexesOneDefaultAndOneModified()
        {
            // given
            SpatialIndexProvider provider = NewSpatialIndexProvider(_config2);

            AddUpdates(provider, _schemaIndexDescriptor1, _layoutUtil1);
            AddUpdates(provider, _schemaIndexDescriptor2, _layoutUtil2);

            // then even though the provider was created with modified configuredSettings, only the second index should have them
            VerifySpatialSettings(IndexFile(_indexId1), _configuredSettings1.forCRS(_crs));
            VerifySpatialSettings(IndexFile(_indexId2), _configuredSettings2.forCRS(_crs));
        }
Esempio n. 5
0
        public static FusionIndexProvider Create(PageCache pageCache, File databaseDirectory, FileSystemAbstraction fs, IndexProvider.Monitor monitor, Config config, OperationalMode operationalMode, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector)
        {
            IndexDirectoryStructure.Factory childDirectoryStructure = SubProviderDirectoryStructure(databaseDirectory);
            bool readOnly           = IndexProviderFactoryUtil.IsReadOnly(config, operationalMode);
            bool archiveFailedIndex = config.Get(GraphDatabaseSettings.archive_failed_index);

            NumberIndexProvider   number   = IndexProviderFactoryUtil.NumberProvider(pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly);
            SpatialIndexProvider  spatial  = IndexProviderFactoryUtil.SpatialProvider(pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly, config);
            TemporalIndexProvider temporal = IndexProviderFactoryUtil.TemporalProvider(pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly);
            LuceneIndexProvider   lucene   = IndexProviderFactoryUtil.LuceneProvider(fs, childDirectoryStructure, monitor, config, operationalMode);

            return(new FusionIndexProvider(EMPTY, number, spatial, temporal, lucene, new FusionSlotSelector10(), Descriptor, directoriesByProvider(databaseDirectory), fs, archiveFailedIndex));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void addUpdates(SpatialIndexProvider provider, org.neo4j.storageengine.api.schema.StoreIndexDescriptor schemaIndexDescriptor, ValueCreatorUtil<SpatialIndexKey,NativeIndexValue> layoutUtil) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        private void AddUpdates(SpatialIndexProvider provider, StoreIndexDescriptor schemaIndexDescriptor, ValueCreatorUtil <SpatialIndexKey, NativeIndexValue> layoutUtil)
        {
            IndexAccessor accessor = provider.GetOnlineAccessor(schemaIndexDescriptor, SamplingConfig());

            using (IndexUpdater updater = accessor.NewUpdater(ONLINE))
            {
                // when
                foreach (IndexEntryUpdate <IndexDescriptor> update in layoutUtil.SomeUpdates(_randomRule))
                {
                    updater.Process(update);
                }
            }
            accessor.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);
            accessor.Dispose();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotLeakSpaceFillingCurveSettingsBetweenExistingAndNewIndexes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotLeakSpaceFillingCurveSettingsBetweenExistingAndNewIndexes()
        {
            // given two indexes previously created with different configuredSettings
            Config config = ConfigWithRange(-10, -10, 10, 10);
            SpatialIndexProvider provider = NewSpatialIndexProvider(config);

            AddUpdates(provider, _schemaIndexDescriptor1, _layoutUtil1);
            AddUpdates(provider, _schemaIndexDescriptor2, _layoutUtil2);

            // and when creating and populating a third index with a third set of configuredSettings
            long indexId3 = 3;
            ConfiguredSpaceFillingCurveSettingsCache settings3 = new ConfiguredSpaceFillingCurveSettingsCache(config);
            SpatialValueCreatorUtil layoutUtil3            = CreateLayoutTestUtil(indexId3, 44);
            StoreIndexDescriptor    schemaIndexDescriptor3 = layoutUtil3.IndexDescriptor();

            CreateEmptyIndex(schemaIndexDescriptor3, provider);
            AddUpdates(provider, schemaIndexDescriptor3, layoutUtil3);

            // Then all indexes should still have their own correct and different configuredSettings
            VerifySpatialSettings(IndexFile(_indexId1), _configuredSettings1.forCRS(_crs));
            VerifySpatialSettings(IndexFile(_indexId2), _configuredSettings2.forCRS(_crs));
            VerifySpatialSettings(IndexFile(indexId3), settings3.ForCRS(_crs));
        }