protected internal RelationshipImporter(BatchingNeoStores stores, IdMapper idMapper, DataStatistics typeDistribution, Monitor monitor, Collector badCollector, bool validateRelationshipData, bool doubleRecordUnits) : base(stores, monitor) { this._doubleRecordUnits = doubleRecordUnits; this._relationshipTypeTokenRepository = stores.RelationshipTypeRepository; this._idMapper = idMapper; this._badCollector = badCollector; this._validateRelationshipData = validateRelationshipData; this._relationshipStore = stores.RelationshipStore; this._relationshipRecord = _relationshipStore.newRecord(); this._relationshipIds = new BatchingIdGetter(_relationshipStore); this._typeCounts = typeDistribution.NewClient(); this._prepareIdSequence = PrepareIdSequence.of(doubleRecordUnits).apply(stores.RelationshipStore); _relationshipRecord.InUse = true; }
//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); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSumCounts() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSumCounts() { // given DataStatistics stats = new DataStatistics(1, 2, new RelationshipTypeCount[0]); Race race = new Race(); int types = 10; long[] expected = new long[types]; int threads = Runtime.Runtime.availableProcessors(); for (int i = 0; i < threads; i++) { long[] local = new long[types]; for (int j = 0; j < types; j++) { local[j] = Random.Next(1_000, 2_000); expected[j] += local[j]; } race.AddContestant(() => { using (DataStatistics.Client client = stats.NewClient()) { for (int typeId = 0; typeId < types; typeId++) { while (local[typeId]-- > 0) { client.Increment(typeId); } } } }); } // when race.Go(); // then stats.forEach(count => assertEquals(expected[count.TypeId], count.Count)); }