@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 ) ); }
@Test public void testVisitIndexDeleteCommand() throws Exception { IndexCommand.DeleteCommand cmd = mock( IndexCommand.DeleteCommand.class ); when( cmd.handle( any( CommandVisitor.class ) ) ).thenCallRealMethod(); // WHEN boolean result = facade.visitIndexDeleteCommand( cmd ); // THEN InOrder inOrder = inOrder( txApplier1, txApplier2, txApplier3 ); inOrder.verify( txApplier1 ).visitIndexDeleteCommand( cmd ); inOrder.verify( txApplier2 ).visitIndexDeleteCommand( cmd ); inOrder.verify( txApplier3 ).visitIndexDeleteCommand( cmd ); inOrder.verifyNoMoreInteractions(); assertFalse( result ); }
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; }
@Override public void serialize( WritableChannel channel ) throws IOException { channel.put( NeoCommandType.INDEX_DELETE_COMMAND ); writeIndexCommandHeader( channel ); } }
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 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 ) ); }
@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 ) ); }
@Override public void serialize( WritableChannel channel ) throws IOException { channel.put( NeoCommandType.INDEX_DELETE_COMMAND ); writeIndexCommandHeader( channel ); } }
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; }