private void writeNeoStoreRecord( WritableChannel channel, NeoStoreRecord record ) throws IOException { channel.putLong( record.getNextProp() ); } }
@Override public String toString() { return getClass().getSimpleName() + "[" + "used=" + inUse() + ",prop=" + getNextProp() + "]"; }
@Override public NeoStoreRecord clone() { NeoStoreRecord neoStoreRecord = new NeoStoreRecord(); neoStoreRecord.setNextProp( getNextProp() ); return neoStoreRecord; } }
@Override public boolean visitNeoStoreCommand( Command.NeoStoreCommand command ) { neoStores.getMetaDataStore().setGraphNextProp( selectRecordByCommandVersion( command ).getNextProp() ); return false; }
@Test public void shouldReadNeoStoreCommand() throws Throwable { // Given InMemoryClosableChannel channel = new InMemoryClosableChannel(); NeoStoreRecord before = new NeoStoreRecord(); NeoStoreRecord after = new NeoStoreRecord(); after.setNextProp( 42 ); new Command.NeoStoreCommand( before, after ).serialize( channel ); // When PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0(); Command command = reader.read( channel ); assertTrue( command instanceof Command.NeoStoreCommand); Command.NeoStoreCommand neoStoreCommand = (Command.NeoStoreCommand) command; // Then assertEquals( before.getNextProp(), neoStoreCommand.getBefore().getNextProp() ); assertEquals( after.getNextProp(), neoStoreCommand.getAfter().getNextProp() ); }
@Test public void shouldApplyNeoStoreCommandToTheStore() throws Exception { // given final BatchTransactionApplier applier = newApplier( false ); final NeoStoreRecord before = new NeoStoreRecord(); final NeoStoreRecord after = new NeoStoreRecord(); after.setNextProp( 42 ); final Command command = new Command.NeoStoreCommand( before, after ); // when boolean result = apply( applier, command::handle, transactionToApply ); // then assertFalse( result ); verify( metaDataStore, times( 1 ) ).setGraphNextProp( after.getNextProp() ); }
@Test public void shouldApplyNeoStoreCommandToTheStoreInRecovery() throws Exception { // given final BatchTransactionApplier applier = newApplier( true ); final NeoStoreRecord before = new NeoStoreRecord(); final NeoStoreRecord after = new NeoStoreRecord(); after.setNextProp( 42 ); final Command command = new Command.NeoStoreCommand( before, after ); // when boolean result = apply( applier, command::handle, transactionToApply ); // then assertFalse( result ); verify( metaDataStore, times( 1 ) ).setGraphNextProp( after.getNextProp() ); }
private void writeNeoStoreRecord( WritableChannel channel, NeoStoreRecord record ) throws IOException { channel.putLong( record.getNextProp() ); } }
@Override public String toString() { return getClass().getSimpleName() + "[" + "used=" + inUse() + ",prop=" + getNextProp() + "]"; }
@Override public NeoStoreRecord clone() { NeoStoreRecord neoStoreRecord = new NeoStoreRecord(); neoStoreRecord.setNextProp( getNextProp() ); return neoStoreRecord; } }
@Override public boolean visitNeoStoreCommand( Command.NeoStoreCommand command ) { neoStores.getMetaDataStore().setGraphNextProp( selectRecordByCommandVersion( command ).getNextProp() ); return false; }