//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); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public PageCursor io(long pageId, int pf_flags) throws java.io.IOException public override PageCursor Io(long pageId, int pfFlags) { StubPageCursor cursor = new StubPageCursor(pageId, _pageSize); PrepareCursor(cursor); return(cursor); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public final void writeRecord(Record record, org.neo4j.io.fs.StoreChannel channel) throws java.io.IOException public void WriteRecord(Record record, StoreChannel channel) { ByteBuffer buffer = ByteBuffer.allocate(RecordSize); StubPageCursor cursor = new StubPageCursor(0, buffer); Write(record, cursor); channel.WriteAll(buffer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustNotCheckForOutOfBoundsWhenReadingSingleRecord() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustNotCheckForOutOfBoundsWhenReadingSingleRecord() { MyRecordFormat format = new MyRecordFormat(this); StubPageCursor cursor = new StubPageCursor(0, 3); format.Read(new MyRecord(this, 0), cursor, RecordLoad.NORMAL, 4); assertFalse(cursor.CheckAndClearBoundsFlag()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustNotCheckForOutOfBoundsWhenWritingSingleRecord() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustNotCheckForOutOfBoundsWhenWritingSingleRecord() { MyRecordFormat format = new MyRecordFormat(this); StubPageCursor cursor = new StubPageCursor(0, 3); MyRecord record = new MyRecord(this, 0); record.InUse = true; format.Write(record, cursor, 4); assertFalse(cursor.CheckAndClearBoundsFlag()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustCheckForOutOfBoundsWhenReadingDoubleRecord() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustCheckForOutOfBoundsWhenReadingDoubleRecord() { MyRecordFormat format = new MyRecordFormat(this); StubPageCursor cursor = new StubPageCursor(0, 4); cursor.PutByte(0, ( sbyte )(HEADER_BIT_RECORD_UNIT + HEADER_BIT_FIRST_RECORD_UNIT)); StubPagedFile pagedFile = new StubPagedFileAnonymousInnerClass(this, cursor); format.ShortsPerRecordConflict.AddLast(2); format.Read(new MyRecord(this, 0), cursor, RecordLoad.NORMAL, 4); assertTrue(cursor.CheckAndClearBoundsFlag()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustCheckForOutOfBoundsWhenWritingDoubleRecord() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustCheckForOutOfBoundsWhenWritingDoubleRecord() { MyRecordFormat format = new MyRecordFormat(this); StubPageCursor cursor = new StubPageCursor(0, 5); MyRecord record = new MyRecord(this, 0); record.RequiresSecondaryUnit = true; record.SecondaryUnitId = 42; record.InUse = true; format.ShortsPerRecordConflict.AddLast(3); // make the write go out of bounds format.Write(record, cursor, 4); assertTrue(cursor.CheckAndClearBoundsFlag()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public final void assertRecordsWrittenCorrectly(java.io.File file, org.neo4j.io.fs.StoreChannel channel) throws java.io.IOException public void AssertRecordsWrittenCorrectly(File file, StoreChannel channel) { int recordSize = RecordSize; long recordsInFile = channel.size() / recordSize; ByteBuffer buffer = ByteBuffer.allocate(recordSize); StubPageCursor cursor = new StubPageCursor(0, buffer); for (int i = 0; i < recordsInFile; i++) { assertThat("reading record id " + i, channel.read(buffer), @is(recordSize)); buffer.flip(); Record expectedRecord = CreateRecord(file, i); cursor.Offset = 0; Record actualRecord = ReadRecord(cursor); buffer.clear(); assertThat(actualRecord, isOneOf(expectedRecord, ZeroRecord())); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReadUnsignedRelationshipTypeId() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReadUnsignedRelationshipTypeId() { // GIVEN using (PageCursor cursor = new StubPageCursor(1, _recordSize * 10)) { int offset = 10; cursor.Next(); RelationshipGroupRecord group = (new RelationshipGroupRecord(2)).initialize(true, short.MaxValue + offset, 1, 2, 3, 4, 5); cursor.Offset = offset; _format.write(group, cursor, _recordSize); // WHEN RelationshipGroupRecord read = new RelationshipGroupRecord(group.Id); cursor.Offset = offset; _format.read(read, cursor, NORMAL, _recordSize); // THEN assertEquals(group, read); } }
private void ResetCursor(StubPageCursor cursor, int recordOffset) { cursor.Offset = recordOffset; }
private bool RecordInUse(StubPageCursor cursor) { sbyte header = cursor.Byte; return((header & IN_USE_BIT) != 0); }
protected internal virtual void PrepareCursor(StubPageCursor cursor) { }
protected internal override void prepareCursor(StubPageCursor cursor) { cursor.PutByte(0, ( sbyte )HEADER_BIT_RECORD_UNIT); }
public StubPagedFileAnonymousInnerClass(BaseHighLimitRecordFormatTest outerInstance, StubPageCursor cursor) : base(3) { this.outerInstance = outerInstance; this._cursor = cursor; }