use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportPropertyKeyNameInconsistencies.
@Test
public void shouldReportPropertyKeyNameInconsistencies() throws Exception {
// given
final Reference<Integer> inconsistentName = new Reference<>();
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
inconsistentName.set(next.propertyKey());
tx.propertyKey(inconsistentName.get(), "FOO");
}
});
StoreAccess access = fixture.directStoreAccess().nativeStores();
DynamicRecord record = access.getPropertyKeyNameStore().getRecord(inconsistentName.get() + 1, access.getPropertyKeyNameStore().newRecord(), FORCE);
record.setNextBlock(record.getId());
access.getPropertyKeyNameStore().updateRecord(record);
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.PROPERTY_KEY_NAME, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportInvalidPropertyKeyIdInIndexRule.
@Test
public void shouldReportInvalidPropertyKeyIdInIndexRule() throws Exception {
// Given
int labelId = createLabel();
int propertyKeyId = fixture.idGenerator().propertyKey();
createIndexRule(labelId, propertyKeyId);
// When
ConsistencySummaryStatistics stats = check();
// Then
on(stats).verify(RecordType.SCHEMA, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportInvalidLabelIdInUniquenessConstraintRule.
@Test
public void shouldReportInvalidLabelIdInUniquenessConstraintRule() throws Exception {
// Given
int labelId = fixture.idGenerator().label();
int propertyKeyId = createPropertyKey();
createUniquenessConstraintRule(labelId, propertyKeyId);
// When
ConsistencySummaryStatistics stats = check();
// Then
// invalid label in both index & owning constraint
on(stats).verify(RecordType.SCHEMA, 2).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportArrayPropertyInconsistencies.
@Test
public void shouldReportArrayPropertyInconsistencies() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
DynamicRecord array = new DynamicRecord(next.arrayProperty());
array.setInUse(true);
array.setCreated();
array.setType(ARRAY.intValue());
array.setNextBlock(next.arrayProperty());
array.setData(UTF8.encode("hello world"));
PropertyBlock block = new PropertyBlock();
block.setSingleBlock((((long) ARRAY.intValue()) << 24) | (array.getId() << 28));
block.addValueRecord(array);
PropertyRecord property = new PropertyRecord(next.property());
property.addPropertyBlock(block);
tx.create(property);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.ARRAY_PROPERTY, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportMismatchedLabels.
@Test
public void shouldReportMismatchedLabels() throws Exception {
final List<Integer> labels = new ArrayList<>();
// given
final Pair<List<DynamicRecord>, List<Integer>> pair = chainOfDynamicRecordsWithLabelsForANode(3);
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
NodeRecord node = new NodeRecord(42, false, -1, -1);
node.setInUse(true);
List<DynamicRecord> dynamicRecords;
dynamicRecords = pair.first();
labels.addAll(pair.other());
node.setLabelField(dynamicPointer(dynamicRecords), dynamicRecords);
tx.create(node);
}
});
long[] before = asArray(labels);
labels.remove(1);
long[] after = asArray(labels);
write(fixture.directStoreAccess().labelScanStore(), asList(labelChanges(42, before, after)));
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.LABEL_SCAN_DOCUMENT, 1).andThatsAllFolks();
}
Aggregations