Search in sources :

Example 1 with RelationshipTypeTokenRecord

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);
}
Also used : RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord) LabelTokenRecord(org.neo4j.kernel.impl.store.record.LabelTokenRecord) Test(org.junit.Test)

Example 2 with RelationshipTypeTokenRecord

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 3 with RelationshipTypeTokenRecord

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 4 with RelationshipTypeTokenRecord

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 5 with RelationshipTypeTokenRecord

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Aggregations

RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)66 Test (org.junit.Test)36 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)33 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)30 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)30 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)17 IOException (java.io.IOException)9 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)7 StorageCommand (org.neo4j.storageengine.api.StorageCommand)6 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)5 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)5 RepeatedTest (org.junit.jupiter.api.RepeatedTest)4 Test (org.junit.jupiter.api.Test)4 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)4 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)4 SchemaRecord (org.neo4j.kernel.impl.store.record.SchemaRecord)4 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)3 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 RelationshipTypeTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand)3 LinkedList (java.util.LinkedList)2