use of org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord in project neo4j by neo4j.
the class CacheSmallStoresRecordAccessTest method shouldServePropertyKeysAndRelationshipLabelsFromSuppliedArrayCaches.
@Test
public void shouldServePropertyKeysAndRelationshipLabelsFromSuppliedArrayCaches() throws Exception {
// given
RecordAccess delegate = mock(RecordAccess.class);
PropertyKeyTokenRecord propertyKey0 = new PropertyKeyTokenRecord(0);
PropertyKeyTokenRecord propertyKey2 = new PropertyKeyTokenRecord(2);
PropertyKeyTokenRecord propertyKey1 = new PropertyKeyTokenRecord(1);
RelationshipTypeTokenRecord relationshipType0 = new RelationshipTypeTokenRecord(0);
RelationshipTypeTokenRecord relationshipType1 = new RelationshipTypeTokenRecord(1);
RelationshipTypeTokenRecord relationshipType2 = new RelationshipTypeTokenRecord(2);
LabelTokenRecord label0 = new LabelTokenRecord(0);
LabelTokenRecord label1 = new LabelTokenRecord(1);
LabelTokenRecord label2 = new LabelTokenRecord(2);
CacheSmallStoresRecordAccess recordAccess = new CacheSmallStoresRecordAccess(delegate, new PropertyKeyTokenRecord[] { propertyKey0, propertyKey1, propertyKey2 }, new RelationshipTypeTokenRecord[] { relationshipType0, relationshipType1, relationshipType2 }, new LabelTokenRecord[] { label0, label1, label2 });
// when
assertThat(recordAccess.propertyKey(0), isDirectReferenceTo(propertyKey0));
assertThat(recordAccess.propertyKey(1), isDirectReferenceTo(propertyKey1));
assertThat(recordAccess.propertyKey(2), isDirectReferenceTo(propertyKey2));
assertThat(recordAccess.relationshipType(0), isDirectReferenceTo(relationshipType0));
assertThat(recordAccess.relationshipType(1), isDirectReferenceTo(relationshipType1));
assertThat(recordAccess.relationshipType(2), isDirectReferenceTo(relationshipType2));
assertThat(recordAccess.label(0), isDirectReferenceTo(label0));
assertThat(recordAccess.label(1), isDirectReferenceTo(label1));
assertThat(recordAccess.label(2), isDirectReferenceTo(label2));
// then
verifyZeroInteractions(delegate);
}
use of org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord in project neo4j by neo4j.
the class RelationshipRecordCheckTest method shouldReportTargetNodeNotReferencingBackForFirstRelationshipInTargetChain.
@Test
public void shouldReportTargetNodeNotReferencingBackForFirstRelationshipInTargetChain() throws Exception {
// given
checkSingleDirection();
initialize(RELATIONSHIPS, NODES);
RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
add(inUse(new RelationshipTypeTokenRecord(4)));
add(inUse(new NodeRecord(1, false, 42, NONE)));
NodeRecord target = add(inUse(new NodeRecord(2, false, 7, NONE)));
// when
ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
// then
verify(report).targetNodeDoesNotReferenceBack(target);
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord in project neo4j by neo4j.
the class RelationshipRecordCheckTest method shouldReportSourceNodeNotInUse.
@Test
public void shouldReportSourceNodeNotInUse() throws Exception {
// given
checkSingleDirection();
initialize(RELATIONSHIPS, NODES);
RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
add(inUse(new RelationshipTypeTokenRecord(4)));
NodeRecord node = add(notInUse(new NodeRecord(1, false, NONE, NONE)));
add(inUse(new NodeRecord(2, false, 42, NONE)));
// when
ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
// then
verify(report).sourceNodeNotInUse(node);
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord in project neo4j by neo4j.
the class RelationshipRecordCheckTest method shouldReportSourceNextReferencingOtherNodes.
@Test
public void shouldReportSourceNextReferencingOtherNodes() throws Exception {
// given
RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
add(inUse(new RelationshipTypeTokenRecord(4)));
add(inUse(new NodeRecord(1, false, 42, NONE)));
add(inUse(new NodeRecord(2, false, 42, NONE)));
RelationshipRecord sNext = add(inUse(new RelationshipRecord(51, 8, 9, 0)));
relationship.setFirstNextRel(sNext.getId());
// when
ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
// then
verify(report).sourceNextReferencesOtherNodes(sNext);
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord in project neo4j by neo4j.
the class RelationshipRecordCheckTest method shouldNotReportAnythingForRelationshipThatDoesNotReferenceOtherRecords.
@Test
public void shouldNotReportAnythingForRelationshipThatDoesNotReferenceOtherRecords() throws Exception {
// given
RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
add(inUse(new RelationshipTypeTokenRecord(4)));
add(inUse(new NodeRecord(1, false, 42, NONE)));
add(inUse(new NodeRecord(2, false, 42, NONE)));
// when
ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
// then
verifyNoMoreInteractions(report);
}
Aggregations