예제 #1
0
        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);
        }
예제 #2
0
        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;
        }
예제 #3
0
//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));
        }
예제 #4
0
 public override long MaxCount()
 {
     try
     {
         using (BoundedIterable <long> reader = _indexAccessor.newAllEntriesReader())
         {
             return(reader.MaxCount());
         }
     }
     catch (Exception e)
     {
         throw new Exception(e);
     }
 }
예제 #5
0
//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));
            }
        }