use of org.neo4j.kernel.impl.index.IndexDefineCommand in project neo4j by neo4j.
the class LegacyIndexTransactionStateImplTest method removalOfRelationshipIndexDoesNotClearNodeCommandsForNodeIndexWithSameName.
@Test
public void removalOfRelationshipIndexDoesNotClearNodeCommandsForNodeIndexWithSameName() {
LegacyIndexTransactionStateImpl state = newLegacyIndexTxState();
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));
}
use of org.neo4j.kernel.impl.index.IndexDefineCommand in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_4Test method shouldReadNoKeyIdAsMinusOne.
@Test
public void shouldReadNoKeyIdAsMinusOne() throws Exception {
// GIVEN
InMemoryClosableChannel channel = new InMemoryClosableChannel();
IndexDefineCommand definitions = new IndexDefineCommand();
int indexNameId = 10;
definitions.init(MapUtil.<String, Integer>genericMap("myindex", indexNameId), MapUtil.<String, Integer>genericMap());
definitions.serialize(channel);
RemoveCommand removeCommand = new IndexCommand.RemoveCommand();
removeCommand.init(indexNameId, IndexEntityType.Node.id(), 1234, -1, null);
removeCommand.serialize(channel);
// WHEN
PhysicalLogCommandReaderV2_2_4 reader = new PhysicalLogCommandReaderV2_2_4();
assertTrue(reader.read(channel) instanceof IndexDefineCommand);
RemoveCommand readRemoveCommand = (RemoveCommand) reader.read(channel);
// THEN
assertEquals(removeCommand.getIndexNameId(), readRemoveCommand.getIndexNameId());
assertEquals(removeCommand.getEntityType(), readRemoveCommand.getEntityType());
assertEquals(removeCommand.getEntityId(), readRemoveCommand.getEntityId());
assertEquals(removeCommand.getKeyId(), readRemoveCommand.getKeyId());
assertNull(removeCommand.getValue());
}
use of org.neo4j.kernel.impl.index.IndexDefineCommand in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0_2 method visitIndexDefineCommand.
private Command visitIndexDefineCommand(ReadableChannel channel) throws IOException {
readIndexCommandHeader(channel);
Map<String, Integer> indexNames = readMap(channel);
Map<String, Integer> keys = readMap(channel);
IndexDefineCommand command = new IndexDefineCommand();
command.init(indexNames, keys);
return command;
}
use of org.neo4j.kernel.impl.index.IndexDefineCommand in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2 method visitIndexDefineCommand.
private Command visitIndexDefineCommand(ReadableChannel channel) throws IOException {
readIndexCommandHeader(channel);
Map<String, Integer> indexNames = readMap(channel);
Map<String, Integer> keys = readMap(channel);
IndexDefineCommand command = new IndexDefineCommand();
command.init(indexNames, keys);
return command;
}
use of org.neo4j.kernel.impl.index.IndexDefineCommand in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_10 method visitIndexDefineCommand.
private Command visitIndexDefineCommand(ReadableChannel channel) throws IOException {
readIndexCommandHeader(channel);
Map<String, Integer> indexNames = readMap(channel);
Map<String, Integer> keys = readMap(channel);
IndexDefineCommand command = new IndexDefineCommand();
command.init(indexNames, keys);
return command;
}
Aggregations