Search in sources :

Example 11 with RelationshipRecord

use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.

the class RelationshipCheckTypeTest method inUseRecordEquality.

@Test
public void inUseRecordEquality() {
    RelationshipRecord record1 = new RelationshipRecord(1);
    record1.initialize(true, 1, 2, 3, 4, 5, 6, 7, 8, true, false);
    record1.setSecondaryUnitId(42);
    RelationshipRecord record2 = record1.clone();
    RelationshipCheckType check = new RelationshipCheckType();
    assertTrue(check.equal(record1, record2));
}
Also used : RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) Test(org.junit.Test)

Example 12 with RelationshipRecord

use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.

the class NodeRecordCheckTest method shouldReportRelationshipNotFirstInSourceChain.

@Test
public void shouldReportRelationshipNotFirstInSourceChain() throws Exception {
    // given
    NodeRecord node = inUse(new NodeRecord(42, false, 7, NONE));
    RelationshipRecord relationship = add(inUse(new RelationshipRecord(7, 42, 0, 0)));
    relationship.setFirstPrevRel(6);
    relationship.setFirstInFirstChain(false);
    relationship.setSecondPrevRel(8);
    relationship.setFirstInSecondChain(false);
    // when
    ConsistencyReport.NodeConsistencyReport report = check(node);
    // then
    verify(report).relationshipNotFirstInSourceChain(relationship);
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 13 with RelationshipRecord

use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.

the class NodeRecordCheckTest method shouldNotReportAnythingForNodeWithConsistentReferences.

@Test
public void shouldNotReportAnythingForNodeWithConsistentReferences() throws Exception {
    // given
    NodeRecord node = inUse(new NodeRecord(42, false, 7, 11));
    add(inUse(new RelationshipRecord(7, 42, 0, 0)));
    add(inUse(new PropertyRecord(11)));
    // when
    ConsistencyReport.NodeConsistencyReport report = check(node);
    // then
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 14 with RelationshipRecord

use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.

the class NodeRecordCheckTest method shouldReportLoopRelationshipNotFirstInTargetAndSourceChains.

@Test
public void shouldReportLoopRelationshipNotFirstInTargetAndSourceChains() throws Exception {
    // given
    NodeRecord node = inUse(new NodeRecord(42, false, 7, NONE));
    RelationshipRecord relationship = add(inUse(new RelationshipRecord(7, 42, 42, 0)));
    relationship.setFirstPrevRel(8);
    relationship.setFirstInFirstChain(false);
    relationship.setSecondPrevRel(8);
    relationship.setFirstInSecondChain(false);
    // when
    ConsistencyReport.NodeConsistencyReport report = check(node);
    // then
    verify(report).relationshipNotFirstInSourceChain(relationship);
    verify(report).relationshipNotFirstInTargetChain(relationship);
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 15 with RelationshipRecord

use of org.neo4j.kernel.impl.store.record.RelationshipRecord 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)

Aggregations

RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)207 Test (org.junit.Test)73 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)69 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)43 Test (org.junit.jupiter.api.Test)34 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)30 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)19 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)19 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 RelationshipStore (org.neo4j.kernel.impl.store.RelationshipStore)14 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)12 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)12 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)12 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)11 InMemoryClosableChannel (org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel)11 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)9 InputRelationship (org.neo4j.unsafe.impl.batchimport.input.InputRelationship)8 RepeatedTest (org.junit.jupiter.api.RepeatedTest)7 IOException (java.io.IOException)6 CursorContext (org.neo4j.io.pagecache.context.CursorContext)6