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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations