Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void checkRecord(RelationshipRecordFormat format, int recordSize, org.neo4j.io.pagecache.StubPageCursor cursor, long recordId, int recordOffset, org.neo4j.kernel.impl.store.record.RelationshipRecord record) throws java.io.IOException
        private void CheckRecord(RelationshipRecordFormat format, int recordSize, StubPageCursor cursor, long recordId, int recordOffset, RelationshipRecord record)
        {
            format.Write(record, cursor, recordSize);

            RelationshipRecord recordFromStore = format.NewRecord();

            recordFromStore.Id = recordId;
            ResetCursor(cursor, recordOffset);
            format.Read(recordFromStore, cursor, RecordLoad.NORMAL, recordSize);

            // records should be the same
            VerifySameReferences(record, recordFromStore);

            // now lets try to read same data into a record with different id - we should get different absolute references
            ResetCursor(cursor, recordOffset);
            RelationshipRecord recordWithOtherId = format.NewRecord();

            recordWithOtherId.Id = 1L;
            format.Read(recordWithOtherId, cursor, RecordLoad.NORMAL, recordSize);

            assertNotEquals(record.FirstNextRel, recordWithOtherId.FirstNextRel);
            assertNotEquals(record.FirstPrevRel, recordWithOtherId.FirstPrevRel);
            assertNotEquals(record.SecondNextRel, recordWithOtherId.SecondNextRel);
            assertNotEquals(record.SecondPrevRel, recordWithOtherId.SecondPrevRel);
        }
Exemplo n.º 2
0
        // Create high-limit record which fits in one record
        private RelationshipRecord CreateCompactRecord(RelationshipRecordFormat format, long recordId, bool firstInFirstChain, bool firstInSecondChain)
        {
            RelationshipRecord record = format.NewRecord();

            record.InUse              = true;
            record.FirstInFirstChain  = firstInFirstChain;
            record.FirstInSecondChain = firstInSecondChain;
            record.Id            = recordId;
            record.FirstNextRel  = recordId + 1L;
            record.FirstNode     = recordId + 2L;
            record.FirstPrevRel  = recordId + 3L;
            record.SecondNextRel = recordId + 4L;
            record.SecondNode    = recordId + 5L;
            record.SecondPrevRel = recordId + 6L;
            record.Type          = 7;
            return(record);
        }