Search in sources :

Example 1 with PropertyKeyTokenRecord

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

the class OwnerCheckTest method shouldReportDynamicRecordOwnedByPropertyKeyAndOtherDynamicRecord.

@Test
public void shouldReportDynamicRecordOwnedByPropertyKeyAndOtherDynamicRecord() 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.PropertyKeyTokenConsistencyReport keyReport = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, keyCheck, key, records);
    ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
    // then
    verifyNoMoreInteractions(keyReport);
    verify(dynReport).nextMultipleOwners(key);
    verifyNoMoreInteractions(dynReport);
}
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)

Example 2 with PropertyKeyTokenRecord

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

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

the class OwnerCheckTest method shouldReportDynamicRecordOwnedByTwoPropertyKeys.

@Test
public void shouldReportDynamicRecordOwnedByTwoPropertyKeys() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true, DynamicStore.PROPERTY_KEY);
    RecordCheck<PropertyKeyTokenRecord, ConsistencyReport.PropertyKeyTokenConsistencyReport> checker = decorator.decoratePropertyKeyTokenChecker(dummyPropertyKeyCheck());
    DynamicRecord dynamic = records.addPropertyKeyName(inUse(string(new DynamicRecord(42))));
    PropertyKeyTokenRecord record1 = records.add(inUse(new PropertyKeyTokenRecord(1)));
    PropertyKeyTokenRecord record2 = records.add(inUse(new PropertyKeyTokenRecord(2)));
    record1.setNameId((int) dynamic.getId());
    record2.setNameId((int) dynamic.getId());
    // when
    ConsistencyReport.PropertyKeyTokenConsistencyReport report1 = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, checker, record1, records);
    ConsistencyReport.PropertyKeyTokenConsistencyReport report2 = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, checker, record2, records);
    // then
    verifyNoMoreInteractions(report1);
    verify(report2).nameMultipleOwners(record1);
    verifyNoMoreInteractions(report2);
}
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)

Example 4 with PropertyKeyTokenRecord

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

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

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