Search in sources :

Example 16 with RelationshipRecord

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

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

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

Example 19 with RelationshipRecord

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

the class RelationshipRecordCheckTest method shouldReportIllegalRelationshipType.

@Test
public void shouldReportIllegalRelationshipType() throws Exception {
    // given
    checkSingleDirection();
    RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, NONE));
    add(inUse(new NodeRecord(1, false, 42, NONE)));
    add(inUse(new NodeRecord(2, false, 42, NONE)));
    // when
    ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
    // then
    verify(report).illegalRelationshipType();
    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 20 with RelationshipRecord

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

the class RelationshipRecordCheckTest method shouldReportSourceNextNotReferencingBack.

@Test
public void shouldReportSourceNextNotReferencingBack() 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, 3, 1, 0)));
    relationship.setFirstNextRel(sNext.getId());
    // when
    ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
    // then
    verify(report).sourceNextDoesNotReferenceBack(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)

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