Exemple #1
0
        private void CloseClient()
        {
            lock (this)
            {
                if (--_opened == 0)
                {
                    int highestTypeId = 0;
                    foreach (Client client in _clients)
                    {
                        highestTypeId = max(highestTypeId, client.HighestTypeId);
                    }

                    long[] counts = new long[highestTypeId + 1];
                    foreach (Client client in _clients)
                    {
                        client.AddTo(counts);
                    }
                    _typeCounts = new RelationshipTypeCount[Counts.Length];
                    for (int i = 0; i < Counts.Length; i++)
                    {
                        _typeCounts[i] = new RelationshipTypeCount(i, counts[i]);
                    }
                    Arrays.sort(_typeCounts);
                }
            }
        }
Exemple #2
0
 private RelationshipTypeCount TypeCount(IEnumerator <RelationshipTypeCount> iterator, int typeId)
 {
     while (iterator.MoveNext())
     {
         RelationshipTypeCount count = iterator.Current;
         if (count.TypeId == typeId)
         {
             return(count);
         }
     }
     throw new System.InvalidOperationException("Couldn't find " + typeId);
 }
Exemple #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGrowArrayProperly()
        public virtual void ShouldGrowArrayProperly()
        {
            // given
            DataStatistics stats = new DataStatistics(1, 1, new RelationshipTypeCount[0]);

            // when
            int typeId = 1_000;

            using (Client client = stats.NewClient())
            {
                client.Increment(typeId);
            }

            // then
            RelationshipTypeCount count = TypeCount(stats.GetEnumerator(), typeId);

            assertEquals(1, count.Count);
            assertEquals(typeId, count.TypeId);
        }
Exemple #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUseDataStatisticsCountsForPrintingFinalStats() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldUseDataStatisticsCountsForPrintingFinalStats()
        {
            // given
            ExecutionMonitor monitor = mock(typeof(ExecutionMonitor));

            using (BatchingNeoStores stores = batchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), NULL, Storage.directory().directory(), defaultFormat(), DEFAULT, Instance, EMPTY, defaults()))
            {
                // when
                RelationshipTypeCount[] relationshipTypeCounts = new RelationshipTypeCount[]
                {
                    new RelationshipTypeCount(0, 33),
                    new RelationshipTypeCount(1, 66)
                };
                DataStatistics dataStatistics = new DataStatistics(100123, 100456, relationshipTypeCounts);
                using (ImportLogic logic = new ImportLogic(Storage.directory().directory(), Storage.fileSystem(), stores, DEFAULT, Instance, monitor, defaultFormat(), NO_MONITOR))
                {
                    logic.PutState(dataStatistics);
                    logic.Success();
                }

                // then
                verify(monitor).done(eq(true), anyLong(), contains(dataStatistics.ToString()));
            }
        }