@Override protected PropertyRecord createNullRecord( long id ) { PropertyRecord record = new PropertyRecord( id ); record.setNextProp( 0 ); record.setPrevProp( 0 ); return record; }
currentRecord.setCreated(); prevRecord.setNextProp( propertyId ); currentRecord.setPrevProp( prevRecord.getId() );
@Test void shouldReportNextPropertyNotInUse() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); PropertyRecord next = add( notInUse( new PropertyRecord( 51 ) ) ); property.setNextProp( next.getId() ); // when ConsistencyReport.PropertyConsistencyReport report = check( property ); // then verify( report ).nextNotInUse( next ); verifyNoMoreInteractions( report ); }
@Test void shouldReportNextPropertyNotReferringBack() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); PropertyRecord next = add( inUse( new PropertyRecord( 51 ) ) ); property.setNextProp( next.getId() ); // when ConsistencyReport.PropertyConsistencyReport report = check( property ); // then verify( report ).nextDoesNotReferenceBack( next ); verifyNoMoreInteractions( report ); }
@Override protected PropertyRecord createExistingRecord( boolean light ) { PropertyRecord record = new PropertyRecord( ID ); record.setId( ID ); record.setNextProp( 2 ); record.setPrevProp( 4 ); record.setInUse( true ); PropertyBlock block = new PropertyBlock(); DynamicRecordAllocator stringAllocator = new ReusableRecordsAllocator( 64, new DynamicRecord( 7 ) ); Value value = Values.of( "a string too large to fit in the property block itself" ); PropertyStore.encodeValue( block, 6, value, stringAllocator, null, true ); if ( light ) { block.getValueRecords().clear(); } record.setPropertyBlock( block ); return record; }
assert prevPropRecord.inUse() : prevPropRecord + "->" + propRecord + " for " + primitive; prevPropRecord.setNextProp( nextProp ); prevPropRecord.setChanged( primitive ); propRecord.setNextProp( Record.NO_NEXT_PROPERTY.intValue() ); propRecord.setChanged( primitive ); assert traverser.assertPropertyChain( primitive, propertyRecords );
currentRecord.setNextProp( nextPropertyId ); propertyStore.updateRecord( currentRecord ); currentRecord = propertyRecord( nextPropertyId );
long nextProp = channel.getLong(); // 8 long prevProp = channel.getLong(); // 8 record.setNextProp( nextProp ); record.setPrevProp( prevProp ); boolean inUse = false;
long nextProp = channel.getLong(); // 8 long prevProp = channel.getLong(); // 8 record.setNextProp( nextProp ); record.setPrevProp( prevProp ); boolean inUse = false;
private void existingChain( ExpectedRecord... initialRecords ) { PropertyRecord prev = null; for ( ExpectedRecord initialRecord : initialRecords ) { PropertyRecord record = this.records.create( propertyStore.nextId(), primitive.record ).forChangingData(); record.setInUse( true ); existingRecord( record, initialRecord ); if ( prev == null ) { // This is the first one, update primitive to point to this primitive.record.setNextProp( record.getId() ); } else { // link property records together record.setPrevProp( prev.getId() ); prev.setNextProp( record.getId() ); } prev = record; } }
record.setNextProp( nextProp ); record.setPrevProp( prevProp );
record.setNextProp( nextProp ); record.setPrevProp( prevProp );
@Override public Generator<PropertyRecord> property() { return ( recordSize, format, recordId ) -> { PropertyRecord record = new PropertyRecord( recordId ); int maxProperties = random.intBetween( 1, 4 ); StandaloneDynamicRecordAllocator stringAllocator = new StandaloneDynamicRecordAllocator(); StandaloneDynamicRecordAllocator arrayAllocator = new StandaloneDynamicRecordAllocator(); record.setInUse( true ); int blocksOccupied = 0; for ( int i = 0; i < maxProperties && blocksOccupied < 4; ) { PropertyBlock block = new PropertyBlock(); // Dynamic records will not be written and read by the property record format, // that happens in the store where it delegates to a "sub" store. PropertyStore.encodeValue( block, random.nextInt( tokenBits ), random.nextValue(), stringAllocator, arrayAllocator, true ); int tentativeBlocksWithThisOne = blocksOccupied + block.getValueBlocks().length; if ( tentativeBlocksWithThisOne <= 4 ) { record.addPropertyBlock( block ); blocksOccupied = tentativeBlocksWithThisOne; } } record.setPrevProp( randomLongOrOccasionallyNull( propertyBits ) ); record.setNextProp( randomLongOrOccasionallyNull( propertyBits ) ); return record; }; }
firstRecord.setNextProp( 12 );
firstRecord.setNextProp( 12 );
assert prevProp.getPrevProp() == Record.NO_PREVIOUS_PROPERTY.intValue(); prevProp.setPrevProp( freeHost.getId() ); freeHost.setNextProp( prevProp.getId() ); prevProp.setChanged( primitive );
@Test public void shouldReportNextPropertyNotInUse() throws Exception { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); PropertyRecord next = add( notInUse( new PropertyRecord( 51 ) ) ); property.setNextProp( next.getId() ); // when ConsistencyReport.PropertyConsistencyReport report = check( property ); // then verify( report ).nextNotInUse( next ); verifyNoMoreInteractions( report ); }
@Test public void shouldReportNextPropertyNotReferringBack() throws Exception { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); PropertyRecord next = add( inUse( new PropertyRecord( 51 ) ) ); property.setNextProp( next.getId() ); // when ConsistencyReport.PropertyConsistencyReport report = check( property ); // then verify( report ).nextDoesNotReferenceBack( next ); verifyNoMoreInteractions( report ); }
@Test public void shouldReportNextReplacedButNotUpdated() throws Exception { PropertyRecord oldProperty = inUse( new PropertyRecord( 42 ) ); oldProperty.setNextProp( 1 ); PropertyRecord newProperty = inUse( new PropertyRecord( 42 ) ); newProperty.setNextProp( 2 ); addChange( notInUse( new PropertyRecord( 2 ) ), inUse( new PropertyRecord( 2 ) ) ).setPrevProp( 42 ); newProperty.setNodeId( add( inUse( new NodeRecord( 100, false, NONE, newProperty.getId() ) ) ).getId() ); // when ConsistencyReport.PropertyConsistencyReport report = checkChange( oldProperty, newProperty ); // then verify( report ).nextNotUpdated(); verifyNoMoreInteractions( report ); }
@Test public void shouldNotReportAnythingWhenAddingAnInitialNextProperty() throws Exception { // given PropertyRecord oldProperty = inUse( new PropertyRecord( 42 ) ); PropertyRecord newProperty = inUse( new PropertyRecord( 42 ) ); PropertyRecord nextProperty = addChange( notInUse( new PropertyRecord( 1 ) ), inUse( new PropertyRecord( 1 ) ) ); nextProperty.setPrevProp( 42 ); newProperty.setNextProp( nextProperty.getId() ); newProperty.setNodeId( add( inUse( new NodeRecord( 100, false, NONE, newProperty.getId() ) ) ).getId() ); // when ConsistencyReport.PropertyConsistencyReport report = checkChange( oldProperty, newProperty ); // then verifyNoMoreInteractions( report ); }