private IndexSample SampleIndex(IndexSampler sampler) { try { return(sampler.SampleIndex()); } catch (IndexNotFoundKernelException e) { throw new Exception(e); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void samplingOverPartitions() throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SamplingOverPartitions() { PartitionedIndexReader indexReader = CreatePartitionedReaderFromReaders(); when(_indexReader1.createSampler()).thenReturn(new SimpleSampler(this, 1)); when(_indexReader2.createSampler()).thenReturn(new SimpleSampler(this, 2)); when(_indexReader3.createSampler()).thenReturn(new SimpleSampler(this, 3)); IndexSampler sampler = indexReader.CreateSampler(); assertEquals(new IndexSample(6, 6, 6), sampler.SampleIndex()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldStopSamplingWhenIndexIsDropped() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldStopSamplingWhenIndexIsDropped() { // given //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: updateAndCommit(asList(add(nodeId, value), add(nodeId2, value2))); UpdateAndCommit(new IList <IndexEntryUpdate <object> > { Add(_nodeId, _value), Add(_nodeId2, _value2) }); // when IndexReader indexReader = _accessor.newReader(); // needs to be acquired before drop() is called IndexSampler indexSampler = indexReader.CreateSampler(); Future <Void> drop = Threading.executeAndAwait((IOFunction <Void, Void>)nothing => { _accessor.drop(); return(nothing); }, null, waitingWhileIn(typeof(TaskCoordinator), "awaitCompletion"), 3, SECONDS); try { using (IndexReader reader = indexReader, IndexSampler sampler = indexSampler) { sampler.SampleIndex(); fail("expected exception"); } } catch (IndexNotFoundKernelException e) { assertEquals("Index dropped while sampling.", e.Message); } finally { drop.get(); } }