public static PropertyBlock propertyBlock( PropertyKeyTokenRecord key, PropertyType type, long value ) { PropertyBlock block = new PropertyBlock(); block.setSingleBlock( key.getId() | (((long) type.intValue()) << 24) | (value << 28) ); return block; }
@Test public void shouldApplyPropertyKeyTokenCommandToTheStoreInRecovery() throws Exception { // given final BatchTransactionApplier applier = newApplier( true ); final PropertyKeyTokenRecord before = new PropertyKeyTokenRecord( 42 ); final PropertyKeyTokenRecord after = new PropertyKeyTokenRecord( 42 ); after.setInUse( true ); after.setNameId( 323 ); final Command.PropertyKeyTokenCommand command = new Command.PropertyKeyTokenCommand( before, after ); final NamedToken token = new NamedToken( "token", 21 ); when( propertyKeyTokenStore.getToken( (int) command.getKey() ) ).thenReturn( token ); // when boolean result = apply( applier, command::handle, transactionToApply ); // then assertFalse( result ); verify( propertyKeyTokenStore, times( 1 ) ).setHighestPossibleIdInUse( after.getId() ); verify( propertyKeyTokenStore, times( 1 ) ).updateRecord( after ); verify( cacheAccess, times( 1 ) ).addPropertyKeyToken( token ); }
private PropertyBlock propertyBlockWith( DynamicRecord dynamicRecord ) { PropertyBlock propertyBlock = new PropertyBlock(); PropertyKeyTokenRecord key = new PropertyKeyTokenRecord( 10 ); propertyBlock.setSingleBlock( key.getId() | (((long) PropertyType.STRING.intValue()) << 24) | (dynamicRecord .getId() << 28) ); propertyBlock.addValueRecord( dynamicRecord ); return propertyBlock; } }
public static PropertyBlock propertyBlock( PropertyKeyTokenRecord key, PropertyType type, long value ) { PropertyBlock block = new PropertyBlock(); block.setSingleBlock( key.getId() | (((long) type.intValue()) << 24) | (value << 28) ); return block; }