Ejemplo n.º 1
0
 private void SetCount(RelationshipGroupCache cache, int nodeId, int count)
 {
     for (int i = 0; i < count; i++)
     {
         cache.IncrementGroupCount(nodeId);
     }
 }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleGroupCountBeyondSignedShortRange()
        public virtual void ShouldHandleGroupCountBeyondSignedShortRange()
        {
            // GIVEN
            long nodeId = 0;
            int  limit  = short.MaxValue + 10;
            RelationshipGroupCache cache = new RelationshipGroupCache(HEAP, ByteUnit.kibiBytes(100), nodeId + 1);

            // WHEN first counting all groups per node
            for (int type = 0; type < limit; type++)
            {
                cache.IncrementGroupCount(nodeId);
            }
            // and WHEN later putting group records into the cache
            RelationshipGroupRecord group = new RelationshipGroupRecord(-1);

            group.OwningNode = nodeId;
            for (int type = 0; type < limit; type++)
            {
                group.Id       = type;
                group.FirstOut = type;                         // just some relationship
                group.Type     = type;
                cache.Put(group);
            }
            long prepared = cache.Prepare(nodeId);

            // THEN that should work, because it used to fail inside prepare, but we can also ask
            // the groupCount method to be sure
            assertEquals(nodeId, prepared);
            assertEquals(limit, cache.GroupCount(nodeId));
        }