Search in sources :

Example 46 with PropertyKeyTokenRecord

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

the class PropertyRecordCheckTest method shouldReportStringRecordNotInUse.

@Test
public void shouldReportStringRecordNotInUse() throws Exception {
    // given
    PropertyRecord property = inUse(new PropertyRecord(42));
    PropertyKeyTokenRecord key = add(inUse(new PropertyKeyTokenRecord(6)));
    DynamicRecord value = add(notInUse(string(new DynamicRecord(1001))));
    PropertyBlock block = propertyBlock(key, value);
    property.addPropertyBlock(block);
    // when
    ConsistencyReport.PropertyConsistencyReport report = check(property);
    // then
    verify(report).stringNotInUse(block, value);
    verifyNoMoreInteractions(report);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 47 with PropertyKeyTokenRecord

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

the class OwnerCheckTest method shouldReportDynamicArrayRecordOwnedByTwoPropertyRecords.

@Test
public void shouldReportDynamicArrayRecordOwnedByTwoPropertyRecords() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true, DynamicStore.ARRAY);
    RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
    DynamicRecord dynamic = records.add(inUse(array(new DynamicRecord(42))));
    PropertyRecord property1 = records.add(inUse(new PropertyRecord(1)));
    PropertyRecord property2 = records.add(inUse(new PropertyRecord(2)));
    PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(10)));
    property1.addPropertyBlock(propertyBlock(key, PropertyType.ARRAY, dynamic.getId()));
    property2.addPropertyBlock(propertyBlock(key, PropertyType.ARRAY, dynamic.getId()));
    // when
    ConsistencyReport.PropertyConsistencyReport report1 = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property1, records);
    ConsistencyReport.PropertyConsistencyReport report2 = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property2, records);
    // then
    verifyNoMoreInteractions(report1);
    verify(report2).arrayMultipleOwners(property1);
    verifyNoMoreInteractions(report2);
}
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 48 with PropertyKeyTokenRecord

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

the class OwnerCheckTest method shouldReportDynamicRecordOwnedByPropertyAndOtherDynamic.

@Test
public void shouldReportDynamicRecordOwnedByPropertyAndOtherDynamic() 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.PropertyConsistencyReport propReport = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property, records);
    ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
    // then
    verifyNoMoreInteractions(propReport);
    verify(dynReport).nextMultipleOwners(property);
    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 49 with PropertyKeyTokenRecord

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

the class OwnerCheckTest method shouldReportDynamicStringRecordOwnedByTwoPropertyRecords.

@Test
public void shouldReportDynamicStringRecordOwnedByTwoPropertyRecords() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true, DynamicStore.STRING);
    RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
    DynamicRecord dynamic = records.add(inUse(string(new DynamicRecord(42))));
    PropertyRecord property1 = records.add(inUse(new PropertyRecord(1)));
    PropertyRecord property2 = records.add(inUse(new PropertyRecord(2)));
    PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(10)));
    property1.addPropertyBlock(propertyBlock(key, PropertyType.STRING, dynamic.getId()));
    property2.addPropertyBlock(propertyBlock(key, PropertyType.STRING, dynamic.getId()));
    // when
    ConsistencyReport.PropertyConsistencyReport report1 = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property1, records);
    ConsistencyReport.PropertyConsistencyReport report2 = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property2, records);
    // then
    verifyNoMoreInteractions(report1);
    verify(report2).stringMultipleOwners(property1);
    verifyNoMoreInteractions(report2);
}
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 50 with PropertyKeyTokenRecord

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

the class OwnerCheckTest method shouldReportDynamicRecordOwnedByOtherDynamicRecordAndPropertyKey.

@Test
public void shouldReportDynamicRecordOwnedByOtherDynamicRecordAndPropertyKey() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true, DynamicStore.PROPERTY_KEY);
    RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.PROPERTY_KEY_NAME, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.PROPERTY_KEY));
    RecordCheck<PropertyKeyTokenRecord, ConsistencyReport.PropertyKeyTokenConsistencyReport> keyCheck = decorator.decoratePropertyKeyTokenChecker(dummyPropertyKeyCheck());
    DynamicRecord owned = records.addPropertyKeyName(inUse(string(new DynamicRecord(42))));
    DynamicRecord dynamic = records.addPropertyKeyName(inUse(string(new DynamicRecord(1))));
    PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(1)));
    dynamic.setNextBlock(owned.getId());
    key.setNameId((int) owned.getId());
    // when
    ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
    ConsistencyReport.PropertyKeyTokenConsistencyReport keyReport = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, keyCheck, key, records);
    // then
    verifyNoMoreInteractions(dynReport);
    verify(keyReport).nameMultipleOwners(dynamic);
    verifyNoMoreInteractions(keyReport);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Aggregations

PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)65 Test (org.junit.Test)31 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)30 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)28 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)16 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)14 IOException (java.io.IOException)10 SchemaRuleUtil.constraintIndexRule (org.neo4j.consistency.checking.SchemaRuleUtil.constraintIndexRule)8 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)8 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)8 NodePropertyDescriptor (org.neo4j.kernel.api.schema.NodePropertyDescriptor)8 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)8 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)6 StorageCommand (org.neo4j.storageengine.api.StorageCommand)6 SchemaRuleUtil.uniquenessConstraintRule (org.neo4j.consistency.checking.SchemaRuleUtil.uniquenessConstraintRule)5 NeoStores (org.neo4j.kernel.impl.store.NeoStores)5 ConstraintRule (org.neo4j.kernel.impl.store.record.ConstraintRule)5 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)5 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)5 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)4