Search in sources :

Example 1 with PropertyRecord

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

the class OwnerCheckTest method shouldReportDynamicArrayRecordOwnedByOtherDynamicAndProperty.

@Test
public void shouldReportDynamicArrayRecordOwnedByOtherDynamicAndProperty() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true, DynamicStore.ARRAY);
    RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.ARRAY_PROPERTY, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.ARRAY));
    RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
    DynamicRecord owned = records.add(inUse(array(new DynamicRecord(42))));
    DynamicRecord dynamic = records.add(inUse(array(new DynamicRecord(100))));
    dynamic.setNextBlock(owned.getId());
    PropertyRecord property = records.add(inUse(new PropertyRecord(1)));
    PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(10)));
    property.addPropertyBlock(propertyBlock(key, PropertyType.ARRAY, owned.getId()));
    // when
    ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
    ConsistencyReport.PropertyConsistencyReport propReport = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property, records);
    // then
    verifyNoMoreInteractions(dynReport);
    verify(propReport).arrayMultipleOwners(dynamic);
    verifyNoMoreInteractions(dynReport);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 2 with PropertyRecord

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

the class OwnerCheckTest method shouldReportDynamicStringRecordOwnedByOtherDynamicAndProperty.

@Test
public void shouldReportDynamicStringRecordOwnedByOtherDynamicAndProperty() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true, DynamicStore.STRING);
    RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.STRING_PROPERTY, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.STRING));
    RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
    DynamicRecord owned = records.add(inUse(string(new DynamicRecord(42))));
    DynamicRecord dynamic = records.add(inUse(string(new DynamicRecord(100))));
    dynamic.setNextBlock(owned.getId());
    PropertyRecord property = records.add(inUse(new PropertyRecord(1)));
    PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(10)));
    property.addPropertyBlock(propertyBlock(key, PropertyType.STRING, owned.getId()));
    // when
    ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
    ConsistencyReport.PropertyConsistencyReport propReport = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property, records);
    // then
    verifyNoMoreInteractions(dynReport);
    verify(propReport).stringMultipleOwners(dynamic);
    verifyNoMoreInteractions(dynReport);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 3 with PropertyRecord

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

the class PendingReferenceCheckTest method shouldNotAllowCheckDiffReferenceAfterCheckReference.

@Test
public void shouldNotAllowCheckDiffReferenceAfterCheckReference() throws Exception {
    // given
    referenceCheck.checkReference(new PropertyRecord(0), null);
    // when
    try {
        referenceCheck.checkDiffReference(new PropertyRecord(0), new PropertyRecord(0), null);
        fail("expected exception");
    }// then
     catch (IllegalStateException expected) {
        assertEquals("Reference has already been checked.", expected.getMessage());
    }
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Test(org.junit.Test)

Example 4 with PropertyRecord

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

the class PendingReferenceCheckTest method shouldAllowSkipAfterCheckDiffReference.

@Test
public void shouldAllowSkipAfterCheckDiffReference() throws Exception {
    // given
    referenceCheck.checkDiffReference(new PropertyRecord(0), new PropertyRecord(0), null);
    // when
    referenceCheck.skip();
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Test(org.junit.Test)

Example 5 with PropertyRecord

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

the class PendingReferenceCheckTest method shouldAllowSkipAfterCheckReference.

@Test
public void shouldAllowSkipAfterCheckReference() throws Exception {
    // given
    referenceCheck.checkReference(new PropertyRecord(0), null);
    // when
    referenceCheck.skip();
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Test(org.junit.Test)

Aggregations

PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)230 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)86 Test (org.junit.Test)75 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)37 Test (org.junit.jupiter.api.Test)36 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)35 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)28 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)19 ArrayList (java.util.ArrayList)17 Value (org.neo4j.values.storable.Value)17 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)14 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)14 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 PropertyStore (org.neo4j.kernel.impl.store.PropertyStore)9 IOException (java.io.IOException)8 InterruptedIOException (java.io.InterruptedIOException)8 Pair (org.neo4j.helpers.collection.Pair)8 DefinedProperty (org.neo4j.kernel.api.properties.DefinedProperty)8 NodeStore (org.neo4j.kernel.impl.store.NodeStore)8