コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRelationshipCountersUpdates()
        public virtual void TestRelationshipCountersUpdates()
        {
            int relationTypes = 2;
            int labels        = 3;

            NodeLabelsCache.Client client = mock(typeof(NodeLabelsCache.Client));
            when(_nodeLabelCache.newClient()).thenReturn(client);
            when(_nodeLabelCache.get(eq(client), eq(1L), any(typeof(int[])))).thenReturn(new int[] { 0, 2 });
            when(_nodeLabelCache.get(eq(client), eq(2L), any(typeof(int[])))).thenReturn(new int[] { 1 });
            when(_nodeLabelCache.get(eq(client), eq(3L), any(typeof(int[])))).thenReturn(new int[] { 1, 2 });
            when(_nodeLabelCache.get(eq(client), eq(4L), any(typeof(int[])))).thenReturn(new int[] {});

            RelationshipCountsProcessor countsProcessor = new RelationshipCountsProcessor(_nodeLabelCache, labels, relationTypes, _countsUpdater, [email protected]_Fields.AutoWithoutPagecache);

            countsProcessor.Process(Record(1, 0, 3));
            countsProcessor.Process(Record(2, 1, 4));

            countsProcessor.Done();

            // wildcard counts
            verify(_countsUpdater).incrementRelationshipCount(ANY, ANY, ANY, 2L);
            verify(_countsUpdater).incrementRelationshipCount(ANY, 0, ANY, 1L);
            verify(_countsUpdater).incrementRelationshipCount(ANY, 1, ANY, 1L);

            // start labels counts
            verify(_countsUpdater).incrementRelationshipCount(0, 0, ANY, 1L);
            verify(_countsUpdater).incrementRelationshipCount(2, 0, ANY, 1L);

            // end labels counts
            verify(_countsUpdater).incrementRelationshipCount(ANY, 0, 1, 1L);
            verify(_countsUpdater).incrementRelationshipCount(ANY, 0, 2, 1L);
        }
コード例 #2
0
        protected internal override void Process(RelationshipRecord[] batch, BatchSender sender)
        {
            RelationshipCountsProcessor processor = processor();

            foreach (RelationshipRecord record in batch)
            {
                if (record.InUse())
                {
                    processor.Process(record);
                }
            }
            _progressMonitor.progress(batch.Length);
        }