public void add( RelationshipTypeTokenRecord before, RelationshipTypeTokenRecord after ) { otherCommands.add( new Command.RelationshipTypeTokenCommand( before, after ) ); }
@Test public void shouldApplyRelationshipTypeTokenCommandToTheStoreInRecovery() throws Exception { // given final BatchTransactionApplier applier = newApplier( true ); final RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord( 42 ); final RelationshipTypeTokenRecord after = new RelationshipTypeTokenRecord( 42 ); after.setInUse( true ); after.setNameId( 323 ); final Command.RelationshipTypeTokenCommand command = new Command.RelationshipTypeTokenCommand( before, after ); final NamedToken token = new NamedToken( "token", 21 ); when( relationshipTypeTokenStore.getToken( (int) command.getKey() ) ).thenReturn( token ); // when boolean result = apply( applier, command::handle, transactionToApply ); // then assertFalse( result ); verify( relationshipTypeTokenStore, times( 1 ) ).setHighestPossibleIdInUse( after.getId() ); verify( relationshipTypeTokenStore, times( 1 ) ).updateRecord( after ); verify( cacheAccess, times( 1 ) ).addRelationshipTypeToken( token ); }
public void relationshipType( int id, String label, int... dynamicIds ) { RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord( id ); RelationshipTypeTokenRecord after = withName( new RelationshipTypeTokenRecord( id ), dynamicIds, label ); otherCommands.add( new Command.RelationshipTypeTokenCommand( before, after ) ); }
recordChangeSet.getRelationshipTypeTokenChanges().changes() ) commands.add( new Command.RelationshipTypeTokenCommand( record.getBefore(), record.forReadingLinkage() ) );
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { // id+in_use(byte)+type_blockId(int)+nr_type_records(int) int id = channel.getInt(); byte inUseFlag = channel.get(); boolean inUse = false; if ( (inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue() ) { inUse = true; } else if ( inUseFlag != Record.NOT_IN_USE.byteValue() ) { throw new IOException( "Illegal in use flag: " + inUseFlag ); } RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord( id ); record.setInUse( inUse ); record.setNameId( channel.getInt() ); int nrTypeRecords = channel.getInt(); for ( int i = 0; i < nrTypeRecords; i++ ) { DynamicRecord dr = readDynamicRecord( channel ); if ( dr == null ) { return null; } record.addNameRecord( dr ); } return new Command.RelationshipTypeTokenCommand( null, record ); }
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { // id+in_use(byte)+type_blockId(int)+nr_type_records(int) int id = channel.getInt(); byte inUseFlag = channel.get(); boolean inUse = false; if ( (inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue() ) { inUse = true; } else if ( inUseFlag != Record.NOT_IN_USE.byteValue() ) { throw new IOException( "Illegal in use flag: " + inUseFlag ); } RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord( id ); record.setInUse( inUse ); record.setNameId( channel.getInt() ); int nrTypeRecords = channel.getInt(); for ( int i = 0; i < nrTypeRecords; i++ ) { DynamicRecord dr = readDynamicRecord( channel ); if ( dr == null ) { return null; } record.addNameRecord( dr ); } return new Command.RelationshipTypeTokenCommand( null, record ); }
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { int id = channel.getInt(); RelationshipTypeTokenRecord before = readRelationshipTypeTokenRecord( id, channel ); if ( before == null ) { return null; } RelationshipTypeTokenRecord after = readRelationshipTypeTokenRecord( id, channel ); if ( after == null ) { return null; } return new Command.RelationshipTypeTokenCommand( before, after ); }
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { int id = channel.getInt(); RelationshipTypeTokenRecord before = readRelationshipTypeTokenRecord( id, channel ); if ( before == null ) { return null; } RelationshipTypeTokenRecord after = readRelationshipTypeTokenRecord( id, channel ); if ( after == null ) { return null; } return new Command.RelationshipTypeTokenCommand( before, after ); }
public void add( RelationshipTypeTokenRecord record ) { Command.RelationshipTypeTokenCommand command = new Command.RelationshipTypeTokenCommand(); command.init( record ); addCommand( command ); }
public void relationshipType( int id, String label, int... dynamicIds ) { Command.RelationshipTypeTokenCommand command = new Command.RelationshipTypeTokenCommand(); command.init( withName( new RelationshipTypeTokenRecord( id ), dynamicIds, label ) ); addCommand( command ); }
recordChangeSet.getRelationshipTypeTokenChanges().changes() ) commands.add( new Command.RelationshipTypeTokenCommand( record.getBefore(), record.forReadingLinkage() ) );
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { // id+in_use(byte)+type_blockId(int)+nr_type_records(int) int id = channel.getInt(); byte inUseFlag = channel.get(); boolean inUse = false; if ( (inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue() ) { inUse = true; } else if ( inUseFlag != Record.NOT_IN_USE.byteValue() ) { throw new IOException( "Illegal in use flag: " + inUseFlag ); } RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord( id ); record.setInUse( inUse ); record.setNameId( channel.getInt() ); int nrTypeRecords = channel.getInt(); for ( int i = 0; i < nrTypeRecords; i++ ) { DynamicRecord dr = readDynamicRecord( channel ); if ( dr == null ) { return null; } record.addNameRecord( dr ); } return new Command.RelationshipTypeTokenCommand( null, record ); }
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { // id+in_use(byte)+type_blockId(int)+nr_type_records(int) int id = channel.getInt(); byte inUseFlag = channel.get(); boolean inUse = false; if ( (inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue() ) { inUse = true; } else if ( inUseFlag != Record.NOT_IN_USE.byteValue() ) { throw new IOException( "Illegal in use flag: " + inUseFlag ); } RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord( id ); record.setInUse( inUse ); record.setNameId( channel.getInt() ); int nrTypeRecords = channel.getInt(); for ( int i = 0; i < nrTypeRecords; i++ ) { DynamicRecord dr = readDynamicRecord( channel ); if ( dr == null ) { return null; } record.addNameRecord( dr ); } return new Command.RelationshipTypeTokenCommand( null, record ); }
@Test public void shouldApplyRelationshipTypeTokenCommandToTheStore() throws Exception { // given final BatchTransactionApplier applier = newApplier( false ); final RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord( 42 ); final RelationshipTypeTokenRecord after = new RelationshipTypeTokenRecord( 42 ); after.setInUse( true ); after.setNameId( 323 ); final Command command = new RelationshipTypeTokenCommand( before, after ); // when boolean result = apply( applier, command::handle, transactionToApply ); // then assertFalse( result ); verify( relationshipTypeTokenStore, times( 1 ) ).updateRecord( after ); }
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { int id = channel.getInt(); RelationshipTypeTokenRecord before = readRelationshipTypeTokenRecord( id, channel ); if ( before == null ) { return null; } RelationshipTypeTokenRecord after = readRelationshipTypeTokenRecord( id, channel ); if ( after == null ) { return null; } return new Command.RelationshipTypeTokenCommand( before, after ); }
private Command visitRelationshipTypeTokenCommand( ReadableChannel channel ) throws IOException { int id = channel.getInt(); RelationshipTypeTokenRecord before = readRelationshipTypeTokenRecord( id, channel ); if ( before == null ) { return null; } RelationshipTypeTokenRecord after = readRelationshipTypeTokenRecord( id, channel ); if ( after == null ) { return null; } return new Command.RelationshipTypeTokenCommand( before, after ); }
public static RelationshipTypeTokenCommand createRelationshipTypeToken( int id, int nameId ) { RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord( id ); RelationshipTypeTokenRecord after = new RelationshipTypeTokenRecord( id ); populateTokenRecord( after, nameId ); return new RelationshipTypeTokenCommand( before, after ); }