/** * Handles format back to 1.9 where the command format didn't have a version. */ @Override public final Command read( ReadableChannel channel ) throws IOException { byte commandType; do { commandType = channel.get(); } while ( commandType == NeoCommandType.NONE ); return read( commandType, channel ); }
@Test public void shouldWriteSchemaRuleToLog() throws Exception { // GIVEN SchemaRecord beforeRecords = serialize( rule, id, false, false); SchemaRecord afterRecords = serialize( rule, id, true, true); SchemaRuleCommand command = new SchemaRuleCommand( beforeRecords, afterRecords, rule ); InMemoryClosableChannel buffer = new InMemoryClosableChannel(); when( neoStores.getSchemaStore() ).thenReturn( schemaStore ); // WHEN command.serialize( buffer ); Command readCommand = reader.read( buffer ); // THEN assertThat( readCommand, instanceOf( SchemaRuleCommand.class ) ); assertSchemaRule( (SchemaRuleCommand)readCommand ); }
@Test public void shouldRecreateSchemaRuleWhenDeleteCommandReadFromDisk() throws Exception { // GIVEN SchemaRecord beforeRecords = serialize( rule, id, true, true); SchemaRecord afterRecords = serialize( rule, id, false, false); SchemaRuleCommand command = new SchemaRuleCommand( beforeRecords, afterRecords, rule ); InMemoryClosableChannel buffer = new InMemoryClosableChannel(); when( neoStores.getSchemaStore() ).thenReturn( schemaStore ); // WHEN command.serialize( buffer ); Command readCommand = reader.read( buffer ); // THEN assertThat( readCommand, instanceOf( SchemaRuleCommand.class ) ); assertSchemaRule( (SchemaRuleCommand)readCommand ); }
/** * Handles format back to 1.9 where the command format didn't have a version. */ @Override public final Command read( ReadableChannel channel ) throws IOException { byte commandType; do { commandType = channel.get(); } while ( commandType == NeoCommandType.NONE ); return read( commandType, channel ); }