//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWorkWhileHavingHeavyConcurrentUpdates() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWorkWhileHavingHeavyConcurrentUpdates() { // given some initial data //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long[] nodes = repeatCreateNamedPeopleFor(NAMES.length * CREATION_MULTIPLIER); long[] nodes = RepeatCreateNamedPeopleFor(_names.Length * _creationMultiplier); int initialNodes = nodes.Length; int threads = 5; _indexOnlineMonitor.initialize(threads); ExecutorService executorService = Executors.newFixedThreadPool(threads); // when populating while creating //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.internal.kernel.api.IndexReference index = createPersonNameIndex(); IndexReference index = CreatePersonNameIndex(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.Collection<java.util.concurrent.Callable<UpdatesTracker>> jobs = new java.util.ArrayList<>(threads); ICollection <Callable <UpdatesTracker> > jobs = new List <Callable <UpdatesTracker> >(threads); for (int i = 0; i < threads; i++) { jobs.Add(() => ExecuteCreationsDeletionsAndUpdates(nodes, _creationMultiplier)); } IList <Future <UpdatesTracker> > futures = executorService.invokeAll(jobs); // sum result into empty result UpdatesTracker result = new UpdatesTracker(); result.NotifyPopulationCompleted(); foreach (Future <UpdatesTracker> future in futures) { result.Add(future.get()); } AwaitIndexesOnline(); executorService.shutdown(); assertTrue(executorService.awaitTermination(1, TimeUnit.MINUTES)); // then AssertIndexedNodesMatchesStoreNodes(); int seenWhilePopulating = initialNodes + result.CreatedDuringPopulation() - result.DeletedDuringPopulation(); double expectedSelectivity = UNIQUE_NAMES / seenWhilePopulating; AssertCorrectIndexSelectivity(expectedSelectivity, IndexSelectivity(index)); AssertCorrectIndexSize("Tracker had " + result, seenWhilePopulating, IndexSize(index)); int expectedIndexUpdates = result.DeletedAfterPopulation() + result.CreatedAfterPopulation() + result.UpdatedAfterPopulation(); AssertCorrectIndexUpdates("Tracker had " + result, expectedIndexUpdates, IndexUpdates(index)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldProvideIndexStatisticsWhenIndexIsBuiltViaPopulationAndConcurrentAdditions() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldProvideIndexStatisticsWhenIndexIsBuiltViaPopulationAndConcurrentAdditions() { // given some initial data _indexOnlineMonitor.initialize(1); int initialNodes = RepeatCreateNamedPeopleFor(_names.Length * _creationMultiplier).Length; // when populating while creating IndexReference index = CreatePersonNameIndex(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final UpdatesTracker updatesTracker = executeCreations(CREATION_MULTIPLIER); UpdatesTracker updatesTracker = ExecuteCreations(_creationMultiplier); AwaitIndexesOnline(); // then int seenWhilePopulating = initialNodes + updatesTracker.CreatedDuringPopulation(); double expectedSelectivity = UNIQUE_NAMES / seenWhilePopulating; AssertCorrectIndexSelectivity(expectedSelectivity, IndexSelectivity(index)); AssertCorrectIndexSize(seenWhilePopulating, IndexSize(index)); AssertCorrectIndexUpdates(updatesTracker.CreatedAfterPopulation(), IndexUpdates(index)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldProvideIndexStatisticsWhenIndexIsBuiltViaPopulationAndConcurrentAdditionsAndChangesAndDeletions() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldProvideIndexStatisticsWhenIndexIsBuiltViaPopulationAndConcurrentAdditionsAndChangesAndDeletions() { // given some initial data _indexOnlineMonitor.initialize(1); long[] nodes = RepeatCreateNamedPeopleFor(_names.Length * _creationMultiplier); int initialNodes = nodes.Length; // when populating while creating IndexReference index = CreatePersonNameIndex(); UpdatesTracker updatesTracker = ExecuteCreationsDeletionsAndUpdates(nodes, _creationMultiplier); AwaitIndexesOnline(); // then AssertIndexedNodesMatchesStoreNodes(); int seenWhilePopulating = initialNodes + updatesTracker.CreatedDuringPopulation() - updatesTracker.DeletedDuringPopulation(); double expectedSelectivity = UNIQUE_NAMES / seenWhilePopulating; int expectedIndexUpdates = updatesTracker.DeletedAfterPopulation() + updatesTracker.CreatedAfterPopulation() + updatesTracker.UpdatedAfterPopulation(); AssertCorrectIndexSelectivity(expectedSelectivity, IndexSelectivity(index)); AssertCorrectIndexSize(seenWhilePopulating, IndexSize(index)); AssertCorrectIndexUpdates(expectedIndexUpdates, IndexUpdates(index)); }