Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {7, 11, 14, 20, 35, 58}) void partitionedIndexPopulation(int affectedNodes) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void PartitionedIndexPopulation(int affectedNodes)
        {
            File rootFolder = new File(_testDir.directory("partitionIndex" + affectedNodes), "uniqueIndex" + affectedNodes);

            using (SchemaIndex uniqueIndex = LuceneSchemaIndexBuilder.create(_descriptor, Config.defaults()).withFileSystem(_fileSystem).withIndexRootFolder(rootFolder).build())
            {
                uniqueIndex.open();

                // index is empty and not yet exist
                assertEquals(0, uniqueIndex.allDocumentsReader().maxCount());
                assertFalse(uniqueIndex.exists());

                using (LuceneIndexAccessor indexAccessor = new LuceneIndexAccessor(uniqueIndex, _descriptor))
                {
                    GenerateUpdates(indexAccessor, affectedNodes);
                    indexAccessor.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);

                    // now index is online and should contain updates data
                    assertTrue(uniqueIndex.Online);

                    using (IndexReader indexReader = indexAccessor.NewReader(), IndexSampler indexSampler = indexReader.CreateSampler())
                    {
                        long[] nodes = PrimitiveLongCollections.asArray(indexReader.Query(IndexQuery.exists(1)));
                        assertEquals(affectedNodes, nodes.Length);

                        IndexSample sample = indexSampler.SampleIndex();
                        assertEquals(affectedNodes, sample.IndexSize());
                        assertEquals(affectedNodes, sample.UniqueValues());
                        assertEquals(affectedNodes, sample.SampleSize());
                    }
                }
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void generateUpdates(org.neo4j.kernel.api.impl.schema.LuceneIndexAccessor indexAccessor, int nodesToUpdate) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        private void GenerateUpdates(LuceneIndexAccessor indexAccessor, int nodesToUpdate)
        {
            using (IndexUpdater updater = indexAccessor.NewUpdater(IndexUpdateMode.ONLINE))
            {
                for (int nodeId = 0; nodeId < nodesToUpdate; nodeId++)
                {
                    updater.Process(Add(nodeId, nodeId));
                }
            }
        }