use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class HighIdTransactionApplierTest method shouldTrackSecondaryUnitIdsAsWell.
@Test
void shouldTrackSecondaryUnitIdsAsWell() throws Exception {
// GIVEN
HighIdTransactionApplier tracker = new HighIdTransactionApplier(neoStores);
NodeRecord node = new NodeRecord(5).initialize(true, 123, true, 456, 0);
node.setSecondaryUnitIdOnLoad(6);
RelationshipRecord relationship = new RelationshipRecord(10).initialize(true, 1, 2, 3, 4, 5, 6, 7, 8, true, true);
relationship.setSecondaryUnitIdOnLoad(12);
RelationshipGroupRecord relationshipGroup = new RelationshipGroupRecord(8).initialize(true, 0, 1, 2, 3, 4, 5);
relationshipGroup.setSecondaryUnitIdOnLoad(20);
// WHEN
tracker.visitNodeCommand(new NodeCommand(new NodeRecord(node.getId()), node));
tracker.visitRelationshipCommand(new RelationshipCommand(new RelationshipRecord(relationship.getId()), relationship));
tracker.visitRelationshipGroupCommand(new RelationshipGroupCommand(new RelationshipGroupRecord(relationshipGroup.getId()), relationshipGroup));
tracker.close();
// THEN
assertEquals(node.getSecondaryUnitId() + 1, neoStores.getNodeStore().getHighId());
assertEquals(relationship.getSecondaryUnitId() + 1, neoStores.getRelationshipStore().getHighId());
assertEquals(relationshipGroup.getSecondaryUnitId() + 1, neoStores.getRelationshipGroupStore().getHighId());
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method readRelationshipCommandWithSecondaryUnit.
@Test
void readRelationshipCommandWithSecondaryUnit() 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(47);
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.kernel.impl.store.record.RelationshipRecord 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.kernel.impl.store.record.RelationshipRecord 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.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadRelationshipCommand.
@Test
void shouldReadRelationshipCommand() throws Throwable {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipRecord before = new RelationshipRecord(42);
before.setLinks(-1, -1, -1);
RelationshipRecord after = new RelationshipRecord(42);
after.initialize(true, 0, 1, 2, 3, 4, 5, 6, 7, true, true);
after.setCreated();
new Command.RelationshipCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipCommand);
Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand) command;
// Then
assertBeforeAndAfterEquals(relationshipCommand, before, after);
}
Aggregations