use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_3D_3Test method shouldReadRelationshipGroupCommandIncludingExternalDegrees.
@Test
void shouldReadRelationshipGroupCommandIncludingExternalDegrees() throws Throwable {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipGroupRecord before = new RelationshipGroupRecord(42).initialize(false, 3, NULL_REF, NULL_REF, NULL_REF, NULL_REF, NULL_REF);
RelationshipGroupRecord after = new RelationshipGroupRecord(42).initialize(true, 3, 4, 5, 6, 7, 8);
after.setHasExternalDegreesOut(random.nextBoolean());
after.setHasExternalDegreesIn(random.nextBoolean());
after.setHasExternalDegreesLoop(random.nextBoolean());
after.setCreated();
new Command.RelationshipGroupCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipGroupCommand);
Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand) command;
// Then
assertBeforeAndAfterEquals(relationshipGroupCommand, before, after);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method nodeCommandWithFixedReferenceFormat.
@Test
void nodeCommandWithFixedReferenceFormat() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
NodeRecord before = new NodeRecord(42).initialize(true, 99, false, 33, 66);
NodeRecord after = new NodeRecord(42).initialize(true, 99, false, 33, 66);
before.setUseFixedReferences(true);
after.setUseFixedReferences(true);
new Command.NodeCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.NodeCommand);
Command.NodeCommand nodeCommand = (Command.NodeCommand) command;
// Then
assertBeforeAndAfterEquals(nodeCommand, before, after);
assertTrue(nodeCommand.getBefore().isUseFixedReferences());
assertTrue(nodeCommand.getAfter().isUseFixedReferences());
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method readRelationshipGroupWithBiggerThanShortRelationshipType.
@Test
public void readRelationshipGroupWithBiggerThanShortRelationshipType() throws IOException {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipGroupRecord before = new RelationshipGroupRecord(42).initialize(false, 3, NULL_REF, NULL_REF, NULL_REF, NULL_REF, NULL_REF);
RelationshipGroupRecord after = new RelationshipGroupRecord(42).initialize(true, (1 << Short.SIZE) + 10, 4, 5, 6, 7, 8);
after.setCreated();
new Command.RelationshipGroupCommand(before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipGroupCommand);
Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand) command;
// Then
assertBeforeAndAfterEquals(relationshipGroupCommand, before, after);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method readRelationshipGroupCommandWithSecondaryUnit.
@Test
void readRelationshipGroupCommandWithSecondaryUnit() throws IOException {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipGroupRecord before = new RelationshipGroupRecord(42).initialize(false, 3, NULL_REF, NULL_REF, NULL_REF, NULL_REF, NULL_REF);
RelationshipGroupRecord after = new RelationshipGroupRecord(42).initialize(true, 3, 4, 5, 6, 7, 8);
after.setSecondaryUnitIdOnCreate(17);
after.setCreated();
new Command.RelationshipGroupCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipGroupCommand);
Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand) command;
// Then
assertBeforeAndAfterEquals(relationshipGroupCommand, before, after);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadInternalLabelCommand.
@Test
void shouldReadInternalLabelCommand() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
LabelTokenRecord before = new LabelTokenRecord(42);
LabelTokenRecord after = before.copy();
after.initialize(true, 13);
after.setCreated();
after.setInternal(true);
new Command.LabelTokenCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.LabelTokenCommand);
Command.LabelTokenCommand labelTokenCommand = (Command.LabelTokenCommand) command;
// Then
assertBeforeAndAfterEquals(labelTokenCommand, before, after);
}
Aggregations