@Override public void setIdTo( PropertyRecord property ) { property.setRelId( getId() ); }
@Test public void shouldApplyRelPropertyCommandToTheStoreInRecovery() throws Exception { // given final BatchTransactionApplier applier = newApplier( true ); final PropertyRecord before = new PropertyRecord( 11 ); final PropertyRecord after = new PropertyRecord( 12 ); after.setRelId( 42 ); final Command command = new Command.PropertyCommand( before, after ); // when boolean result = apply( applier, command::handle, transactionToApply ); // then assertFalse( result ); verify( propertyStore, times( 1 ) ).setHighestPossibleIdInUse( 12 ); verify( propertyStore, times( 1 ) ).updateRecord( after ); }
@Test public void shouldApplyRelPropertyCommandToTheStore() throws Exception { // given final BatchTransactionApplier applier = newApplier( false ); final PropertyRecord before = new PropertyRecord( 11 ); final PropertyRecord after = new PropertyRecord( 12 ); after.setRelId( 42 ); final Command command = new Command.PropertyCommand( before, after ); // when boolean result = apply( applier, command::handle, transactionToApply ); // then assertFalse( result ); verify( propertyStore, times( 1 ) ).updateRecord( after ); }
public void create( PropertyRecord property ) { property.setCreated(); PropertyRecord before = new PropertyRecord( property.getId() ); if ( property.isNodeSet() ) { before.setNodeId( property.getNodeId() ); } if ( property.isRelSet() ) { before.setRelId( property.getRelId() ); } update( before, property ); }
record.setRelId( primitiveId );
record.setRelId( primitiveId );
record.setRelId( primitiveId );
record.setRelId( primitiveId );
@Test public void shouldContainFedRelationshipUpdate() throws Exception { OnlineIndexUpdates onlineIndexUpdates = new OnlineIndexUpdates( nodeStore, relationshipStore, indexingService, propertyPhysicalToLogicalConverter ); long relId = 0; RelationshipRecord inUse = getRelationship( relId, true, ENTITY_TOKEN ); Value propertyValue = Values.of( "hej" ); long propertyId = createRelationshipProperty( inUse, propertyValue, 1 ); RelationshipRecord notInUse = getRelationship( relId, false, ENTITY_TOKEN ); relationshipStore.updateRecord( inUse ); Command.RelationshipCommand relationshipCommand = new Command.RelationshipCommand( inUse, notInUse ); PropertyRecord propertyBlocks = new PropertyRecord( propertyId ); propertyBlocks.setRelId( relId ); Command.PropertyCommand propertyCommand = new Command.PropertyCommand( recordAccess.getIfLoaded( propertyId ).forReadingData(), propertyBlocks ); StoreIndexDescriptor indexDescriptor = forSchema( multiToken( ENTITY_TOKENS, RELATIONSHIP, 1, 4, 6 ), EMPTY.getProviderDescriptor() ).withId( 0 ); indexingService.createIndexes( indexDescriptor ); indexingService.getIndexProxy( indexDescriptor.schema() ).awaitStoreScanCompleted(); onlineIndexUpdates.feed( LongObjectMaps.immutable.empty(), LongObjectMaps.immutable.of( relId, singletonList( propertyCommand ) ), LongObjectMaps.immutable.empty(), LongObjectMaps.immutable.of( relId, relationshipCommand ) ); assertTrue( onlineIndexUpdates.hasUpdates() ); Iterator<IndexEntryUpdate<SchemaDescriptor>> iterator = onlineIndexUpdates.iterator(); assertEquals( iterator.next(), IndexEntryUpdate.remove( relId, indexDescriptor, propertyValue, null, null ) ); assertFalse( iterator.hasNext() ); }
propertyBlocks.setRelId( relId ); Command.PropertyCommand propertyCommand = new Command.PropertyCommand( recordAccess.getIfLoaded( propertyId ).forReadingData(), propertyBlocks ); propertyBlocks2.setRelId( relId ); Command.PropertyCommand propertyCommand2 = new Command.PropertyCommand( recordAccess.getIfLoaded( propertyId2 ).forReadingData(), propertyBlocks2 );
relationshipPropertyBlocks.setRelId( relId ); Command.PropertyCommand relationshipPropertyCommand = new Command.PropertyCommand( recordAccess.getIfLoaded( propertyId ).forReadingData(), relationshipPropertyBlocks );
@Override public void setIdTo( PropertyRecord property ) { property.setRelId( getId() ); }
@Test public void shouldReportPropertyChangedForWrongRelationship() throws Exception { // given PropertyRecord oldProperty = inUse( new PropertyRecord( 42 ) ); PropertyRecord newProperty = notInUse( new PropertyRecord( 42 ) ); newProperty.setRelId( 10 ); add( inUse( new RelationshipRecord( 10, 100, 200, 0 ) ) ); // when ConsistencyReport.PropertyConsistencyReport report = checkChange( oldProperty, newProperty ); // then verify( report ).changedForWrongOwner(); verifyNoMoreInteractions( report ); }
@Test public void shouldReportPropertyNotReferencedFromRelationship() throws Exception { // given PropertyRecord oldProperty = notInUse( new PropertyRecord( 42 ) ); PropertyRecord newProperty = inUse( new PropertyRecord( 42 ) ); newProperty.setRelId( add( inUse( new RelationshipRecord( 1, 10, 20, 0 ) ) ).getId() ); // when ConsistencyReport.PropertyConsistencyReport report = checkChange( oldProperty, newProperty ); // then verify( report ).ownerDoesNotReferenceBack(); verifyNoMoreInteractions( report ); }
public void create( PropertyRecord property ) { property.setCreated(); PropertyRecord before = new PropertyRecord( property.getLongId() ); if ( property.isNodeSet() ) { before.setNodeId( property.getNodeId() ); } if ( property.isRelSet() ) { before.setRelId( property.getRelId() ); } update( before, property ); }
record.setRelId( primitiveId );
@Test public void shouldReportPropertyChangedForWrongRelationshipWithChain() throws Exception { // given PropertyRecord oldProperty = inUse( new PropertyRecord( 42 ) ); PropertyRecord newProperty = notInUse( new PropertyRecord( 42 ) ); RelationshipRecord rel = add( inUse( new RelationshipRecord( 1, 10, 20, 0 ) ) ); PropertyRecord a = add( inUse( new PropertyRecord( 1 ) ) ); PropertyRecord b = add( inUse( new PropertyRecord( 2 ) ) ); a.setNextProp( b.getId() ); b.setPrevProp( a.getId() ); rel.setNextProp( a.getId() ); newProperty.setRelId( rel.getId() ); // when ConsistencyReport.PropertyConsistencyReport report = checkChange( oldProperty, newProperty ); // then verify( report ).changedForWrongOwner(); verifyNoMoreInteractions( report ); }
@Test public void shouldReportPropertyNotReferencedFromRelationshipWithChain() throws Exception { // given PropertyRecord oldProperty = notInUse( new PropertyRecord( 42 ) ); PropertyRecord newProperty = inUse( new PropertyRecord( 42 ) ); RelationshipRecord rel = add( inUse( new RelationshipRecord( 1, 10, 20, 0 ) ) ); PropertyRecord a = add( inUse( new PropertyRecord( 1 ) ) ); PropertyRecord b = add( inUse( new PropertyRecord( 2 ) ) ); a.setNextProp( b.getId() ); b.setPrevProp( a.getId() ); rel.setNextProp( a.getId() ); newProperty.setRelId( rel.getId() ); // when ConsistencyReport.PropertyConsistencyReport report = checkChange( oldProperty, newProperty ); // then verify( report ).ownerDoesNotReferenceBack(); verifyNoMoreInteractions( report ); }
record.setRelId( primitiveId );