private TransactionRepresentation sillyTransaction( int size ) { Collection<StorageCommand> commands = new ArrayList<>( size ); for ( int i = 0; i < size; i++ ) { // The actual data isn't super important commands.add( createNode( i ) ); commands.add( createProperty( i, PropertyType.INT, 0 ) ); } PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation( commands ); tx.setHeader( new byte[0], 0, 0, 0, 0, 0, 0 ); return tx; }
@Test public void shouldReadSomeCommands() throws Exception { // GIVEN InMemoryClosableChannel channel = new InMemoryClosableChannel(); Commands.createNode( 0 ).serialize( channel ); Commands.createNode( 1 ).serialize( channel ); Commands.createRelationshipTypeToken( 0, 0 ).serialize( channel ); Commands.createRelationship( 0, 0, 1, 0 ).serialize( channel ); Commands.createPropertyKeyToken( 0, 0 ).serialize( channel ); Commands.createProperty( 0, PropertyType.SHORT_STRING, 0 ).serialize( channel ); CommandReader reader = new PhysicalLogCommandReaderV3_0(); // THEN assertTrue( reader.read( channel ) instanceof Command.NodeCommand ); assertTrue( reader.read( channel ) instanceof Command.NodeCommand ); assertTrue( reader.read( channel ) instanceof Command.RelationshipTypeTokenCommand ); assertTrue( reader.read( channel ) instanceof Command.RelationshipCommand ); assertTrue( reader.read( channel ) instanceof Command.PropertyKeyTokenCommand ); assertTrue( reader.read( channel ) instanceof Command.PropertyCommand ); }
tracker.visitPropertyCommand( Commands.createProperty( 10, PropertyType.STRING, 0, 6, 7 ) ); tracker.visitPropertyCommand( Commands.createProperty( 20, PropertyType.ARRAY, 1, 8, 9 ) );