private static BoundedIterable <long> MockedAllEntriesReader(bool knownMaxCount, IList <long> entries) { BoundedIterable <long> mockedAllEntriesReader = mock(typeof(BoundedIterable)); when(mockedAllEntriesReader.MaxCount()).thenReturn(knownMaxCount ? entries.Count : Org.Neo4j.Helpers.Collection.BoundedIterable_Fields.UNKNOWN_MAX_COUNT); when(mockedAllEntriesReader.GetEnumerator()).thenReturn(entries.GetEnumerator()); return(mockedAllEntriesReader); }
internal RecordScanner(string name, Statistics statistics, int threads, BoundedIterable <RECORD> store, ProgressMonitorFactory.MultiPartBuilder builder, RecordProcessor <RECORD> processor, params IterableStore[] warmUpStores) : base(name, statistics, threads) { this.Store = store; this.Processor = processor; long maxCount = store.MaxCount(); this.Progress = maxCount == -1 ? builder.ProgressForUnknownPart(name) : builder.ProgressForPart(name, maxCount); this._warmUpStores = warmUpStores; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void allEntriesReaderMustReportFusionMaxCountOfAll() public virtual void AllEntriesReaderMustReportFusionMaxCountOfAll() { long lastId = 0; foreach (IndexAccessor accessor in _aliveAccessors) { MockSingleAllEntriesReader(accessor, Arrays.asList(lastId++, lastId++)); } // then BoundedIterable <long> fusionAllEntriesReader = _fusionIndexAccessor.newAllEntriesReader(); assertThat(fusionAllEntriesReader.MaxCount(), @is(lastId)); }
public override long MaxCount() { try { using (BoundedIterable <long> reader = _indexAccessor.newAllEntriesReader()) { return(reader.MaxCount()); } } catch (Exception 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 allEntriesReaderMustReportUnknownMaxCountIfAnyReportUnknownMaxCount() public virtual void AllEntriesReaderMustReportUnknownMaxCountIfAnyReportUnknownMaxCount() { for (int i = 0; i < _aliveAccessors.Length; i++) { for (int j = 0; j < _aliveAccessors.Length; j++) { // given if (j == i) { MockSingleAllEntriesReaderWithUnknownMaxCount(_aliveAccessors[j], Collections.emptyList()); } else { MockSingleAllEntriesReader(_aliveAccessors[j], Collections.emptyList()); } } // then BoundedIterable <long> fusionAllEntriesReader = _fusionIndexAccessor.newAllEntriesReader(); assertThat(fusionAllEntriesReader.MaxCount(), @is(Org.Neo4j.Helpers.Collection.BoundedIterable_Fields.UNKNOWN_MAX_COUNT)); } }