//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private <R extends org.neo4j.kernel.impl.store.record.AbstractBaseRecord> void writeRecord(R record, RecordFormat<R> format, org.neo4j.io.pagecache.PagedFile storeFile, int recordSize, org.neo4j.kernel.impl.store.id.BatchingIdSequence idSequence) throws java.io.IOException
        private void WriteRecord <R>(R record, RecordFormat <R> format, PagedFile storeFile, int recordSize, BatchingIdSequence idSequence) where R : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
        {
            using (PageCursor cursor = storeFile.Io(0, Org.Neo4j.Io.pagecache.PagedFile_Fields.PfSharedWriteLock))
            {
                AssertedNext(cursor);
                if (record.inUse())
                {
                    format.Prepare(record, recordSize, idSequence);
                }

                int offset = Math.toIntExact(record.Id * recordSize);
                cursor.Offset = offset;
                format.Write(record, cursor, recordSize);
                AssertWithinBounds(record, cursor, "writing");
            }
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleRelationshipTypesBeyond2Bytes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleRelationshipTypesBeyond2Bytes()
        {
            // given
            RecordFormat <RelationshipTypeTokenRecord> format = HighLimit.RecordFormats.relationshipTypeToken();
            int typeId = 1 << ((sizeof(short) * 8) + (sizeof(sbyte) * 8)) - 1;
            RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord(typeId);
            int recordSize = format.GetRecordSize(NO_STORE_HEADER);

            record.Initialize(true, 10);
            IdSequence doubleUnits = mock(typeof(IdSequence));
            PageCursor cursor      = new StubPageCursor(0, ( int )kibiBytes(8));

            // when
            format.Prepare(record, recordSize, doubleUnits);
            format.Write(record, cursor, recordSize);
            verifyNoMoreInteractions(doubleUnits);

            // then
            RelationshipTypeTokenRecord read = new RelationshipTypeTokenRecord(typeId);

            format.Read(record, cursor, NORMAL, recordSize);
            assertEquals(record, read);
        }