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