use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadPropertyKeyCommand.
@Test
void shouldReadPropertyKeyCommand() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
PropertyKeyTokenRecord before = new PropertyKeyTokenRecord(42);
PropertyKeyTokenRecord after = before.copy();
after.initialize(true, 13);
after.setCreated();
new Command.PropertyKeyTokenCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.PropertyKeyTokenCommand);
Command.PropertyKeyTokenCommand propertyKeyTokenCommand = (Command.PropertyKeyTokenCommand) command;
// Then
assertBeforeAndAfterEquals(propertyKeyTokenCommand, before, after);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method readRelationshipCommandWithFixedReferenceFormat.
@Test
void readRelationshipCommandWithFixedReferenceFormat() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipRecord before = new RelationshipRecord(42);
before.initialize(true, 0, 1, 2, 3, 4, 5, 6, 7, true, true);
before.setUseFixedReferences(true);
RelationshipRecord after = new RelationshipRecord(42);
after.initialize(true, 0, 1, 8, 3, 4, 5, 6, 7, true, true);
after.setUseFixedReferences(true);
new Command.RelationshipCommand(writer(), before, after).serialize(channel);
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipCommand);
Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand) command;
assertBeforeAndAfterEquals(relationshipCommand, before, after);
assertTrue(relationshipCommand.getBefore().isUseFixedReferences());
assertTrue(relationshipCommand.getAfter().isUseFixedReferences());
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method readPropertyCommandWithFixedReferenceFormat.
@Test
void readPropertyCommandWithFixedReferenceFormat() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
PropertyRecord before = new PropertyRecord(1);
PropertyRecord after = new PropertyRecord(1);
before.setUseFixedReferences(true);
after.setUseFixedReferences(true);
new Command.PropertyCommand(writer(), before, after).serialize(channel);
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.PropertyCommand);
Command.PropertyCommand propertyCommand = (Command.PropertyCommand) command;
// Then
assertBeforeAndAfterEquals(propertyCommand, before, after);
assertTrue(propertyCommand.getBefore().isUseFixedReferences());
assertTrue(propertyCommand.getAfter().isUseFixedReferences());
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method readRelationshipCommandWithNonRequiredSecondaryUnit.
@Test
void readRelationshipCommandWithNonRequiredSecondaryUnit() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipRecord before = new RelationshipRecord(42);
before.initialize(true, 0, 1, 2, 3, 4, 5, 6, 7, true, true);
before.setSecondaryUnitIdOnLoad(52);
RelationshipRecord after = new RelationshipRecord(42);
after.initialize(true, 0, 1, 8, 3, 4, 5, 6, 7, true, true);
new Command.RelationshipCommand(writer(), before, after).serialize(channel);
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipCommand);
Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand) command;
assertBeforeAndAfterEquals(relationshipCommand, before, after);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadRelationshipTypeCommand.
@Test
void shouldReadRelationshipTypeCommand() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord(42);
RelationshipTypeTokenRecord after = before.copy();
after.initialize(true, 13);
after.setCreated();
new Command.RelationshipTypeTokenCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipTypeTokenCommand);
Command.RelationshipTypeTokenCommand relationshipTypeTokenCommand = (Command.RelationshipTypeTokenCommand) command;
// Then
assertBeforeAndAfterEquals(relationshipTypeTokenCommand, before, after);
}
Aggregations