use of org.neo4j.kernel.impl.store.record.RelationshipGroupRecord in project neo4j by neo4j.
the class RelationshipGroupRecordFormatTest method readWriteFixedReferencesRecord.
@Test
public void readWriteFixedReferencesRecord() throws Exception {
RelationshipGroupRecord source = new RelationshipGroupRecord(1);
RelationshipGroupRecord target = new RelationshipGroupRecord(1);
source.initialize(true, randomType(), randomFixedReference(), randomFixedReference(), randomFixedReference(), randomFixedReference(), randomFixedReference());
writeReadRecord(source, target);
assertTrue("Record should use fixed reference format.", target.isUseFixedReferences());
verifySame(source, target);
}
use of org.neo4j.kernel.impl.store.record.RelationshipGroupRecord in project neo4j by neo4j.
the class RelationshipGroupRecordFormatTest method useFixedReferenceFormatWhenOneOfTheReferencesIsMissing.
@Test
public void useFixedReferenceFormatWhenOneOfTheReferencesIsMissing() throws IOException {
RelationshipGroupRecord source = new RelationshipGroupRecord(1);
RelationshipGroupRecord target = new RelationshipGroupRecord(1);
verifyRecordsWithPoisonedReference(source, target, NULL);
}
use of org.neo4j.kernel.impl.store.record.RelationshipGroupRecord in project neo4j by neo4j.
the class RelationshipGroupRecordFormatTest method useVariableLengthFormatWhenRecordSizeIsTooSmall.
@Test
public void useVariableLengthFormatWhenRecordSizeIsTooSmall() throws IOException {
RelationshipGroupRecord source = new RelationshipGroupRecord(1);
RelationshipGroupRecord target = new RelationshipGroupRecord(1);
source.initialize(true, randomType(), randomFixedReference(), randomFixedReference(), randomFixedReference(), randomFixedReference(), randomFixedReference());
writeReadRecord(source, target, RelationshipGroupRecordFormat.FIXED_FORMAT_RECORD_SIZE - 1);
assertFalse("Record should use variable length reference if format record is too small.", target.isUseFixedReferences());
verifySame(source, target);
}
use of org.neo4j.kernel.impl.store.record.RelationshipGroupRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0Test method readRelationshipGroupCommandWithNonRequiredSecondaryUnit.
@Test
public void readRelationshipGroupCommandWithNonRequiredSecondaryUnit() throws IOException {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipGroupRecord before = new RelationshipGroupRecord(42, 3);
RelationshipGroupRecord after = new RelationshipGroupRecord(42, 3, 4, 5, 6, 7, 8, true);
after.setRequiresSecondaryUnit(false);
after.setSecondaryUnitId(17);
after.setCreated();
new Command.RelationshipGroupCommand(before, after).serialize(channel);
// When
PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0();
Command command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipGroupCommand);
Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand) command;
// Then
assertEquals(before, relationshipGroupCommand.getBefore());
assertEquals(after, relationshipGroupCommand.getAfter());
verifySecondaryUnit(after, relationshipGroupCommand.getAfter());
}
use of org.neo4j.kernel.impl.store.record.RelationshipGroupRecord in project neo4j by neo4j.
the class PhysicalLogCommandReadersTest method assertValidRelGroupCommand.
private static void assertValidRelGroupCommand(StorageCommand command) {
assertThat(command, instanceOf(RelationshipGroupCommand.class));
RelationshipGroupCommand relGroupCommand = (RelationshipGroupCommand) command;
RelationshipGroupRecord record = relGroupCommand.getAfter();
assertEquals(ID, record.getId());
if (IN_USE_FLAG == Record.IN_USE.byteValue()) {
assertTrue(record.inUse());
} else if (IN_USE_FLAG == Record.NOT_IN_USE.byteValue()) {
assertFalse(record.inUse());
} else {
throw new IllegalStateException("Illegal inUse flag: " + IN_USE_FLAG);
}
assertEquals(TYPE_AS_INT, record.getType());
assertEquals(NEXT, record.getNext());
assertEquals(FIRST_OUT, record.getFirstOut());
assertEquals(FIRST_IN, record.getFirstIn());
assertEquals(FIRST_LOOP, record.getNext());
assertEquals(OWNING_NODE, record.getOwningNode());
}
Aggregations