@Test public void removalOfNodeIndexDoesNotClearRelationshipCommandsForRelationshipIndexWithSameName() { ExplicitIndexTransactionStateImpl state = newExplicitIndexTxState(); state.addNode( "index", 1, "key", "value" ); state.addRelationship( "index", 1, "key", "value", 11, 11 ); state.deleteIndex( IndexEntityType.Node, "index" ); IndexDefineCommand indexDefinedCommand = new IndexDefineCommand(); indexDefinedCommand.getOrAssignIndexNameId( "index" ); indexDefinedCommand.getOrAssignKeyId( "key" ); IndexCommand.DeleteCommand delete = new IndexCommand.DeleteCommand(); delete.init( 1, IndexEntityType.Node.id() ); Set<Command> expectedCommands = new HashSet<>( Arrays.asList( indexDefinedCommand, delete, addRelationship( 1, 1, 1, "value", 11, 11 ) ) ); assertEquals( expectedCommands, extractCommands( state ) ); }
@Test public void relationshipIndexDeletionRemovesCommands() { ExplicitIndexTransactionStateImpl state = newExplicitIndexTxState(); state.removeRelationship( "index", 1, "key", "value1" ); state.addRelationship( "index", 2, "key", "value2", 11, 11 ); state.addRelationship( "index", 3, "key", "value3", 22, 22 ); state.deleteIndex( IndexEntityType.Relationship, "index" ); IndexDefineCommand indexDefinedCommand = new IndexDefineCommand(); indexDefinedCommand.getOrAssignIndexNameId( "index" ); indexDefinedCommand.getOrAssignKeyId( "key" ); IndexCommand.DeleteCommand delete = new IndexCommand.DeleteCommand(); delete.init( 1, IndexEntityType.Relationship.id() ); Set<Command> expectedCommands = new HashSet<>( Arrays.asList( indexDefinedCommand, delete ) ); assertEquals( expectedCommands, extractCommands( state ) ); }
@Test public void nodeIndexDeletionRemovesCommands() { ExplicitIndexTransactionStateImpl state = newExplicitIndexTxState(); state.addNode( "index", 1, "key", "value1" ); state.addNode( "index", 2, "key", "value2" ); state.removeNode( "index", 3, "key", "value3" ); state.deleteIndex( IndexEntityType.Node, "index" ); IndexDefineCommand indexDefinedCommand = new IndexDefineCommand(); indexDefinedCommand.getOrAssignIndexNameId( "index" ); indexDefinedCommand.getOrAssignKeyId( "key" ); IndexCommand.DeleteCommand delete = new IndexCommand.DeleteCommand(); delete.init( 1, IndexEntityType.Node.id() ); Set<Command> expectedCommands = new HashSet<>( Arrays.asList( indexDefinedCommand, delete ) ); assertEquals( expectedCommands, extractCommands( state ) ); }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }
@Override public void deleteIndex( IndexEntityType entityType, String indexName ) { DeleteCommand command = new DeleteCommand(); command.init( definitions().getOrAssignIndexNameId( indexName ), entityType.id() ); addCommand( indexName, command, true ); }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }
@Test public void removalOfRelationshipIndexDoesNotClearNodeCommandsForNodeIndexWithSameName() { ExplicitIndexTransactionStateImpl state = newExplicitIndexTxState(); state.addNode( "index", 1, "key", "value" ); state.addRelationship( "index", 1, "key", "value", 11, 11 ); state.deleteIndex( IndexEntityType.Relationship, "index" ); IndexDefineCommand indexDefinedCommand = new IndexDefineCommand(); indexDefinedCommand.getOrAssignIndexNameId( "index" ); indexDefinedCommand.getOrAssignKeyId( "key" ); IndexCommand.DeleteCommand delete = new IndexCommand.DeleteCommand(); delete.init( 1, IndexEntityType.Relationship.id() ); Set<Command> expectedCommands = new HashSet<>( Arrays.asList( indexDefinedCommand, delete, addNode( 1, 1, 1, "value" ) ) ); assertEquals( expectedCommands, extractCommands( state ) ); }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }
@Override public void deleteIndex( IndexEntityType entityType, String indexName ) { DeleteCommand command = new DeleteCommand(); command.init( definitions().getOrAssignIndexNameId( indexName ), entityType.id() ); addCommand( indexName, command, true ); }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }
private Command visitIndexDeleteCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); DeleteCommand command = new DeleteCommand(); command.init( header.indexNameId, header.entityType ); return command; }