use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportMissingMandatoryNodeProperty.
@Test
public void shouldReportMissingMandatoryNodeProperty() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
// structurally correct, but does not have the 'mandatory' property with the 'draconian' label
NodeRecord node = new NodeRecord(next.node(), false, -1, next.property());
node.setInUse(true);
node.setLabelField(inlinedLabelsLongRepresentation(draconian), Collections.<DynamicRecord>emptySet());
PropertyRecord property = new PropertyRecord(node.getNextProp(), node);
property.setInUse(true);
PropertyBlock block = new PropertyBlock();
block.setSingleBlock(key | (((long) PropertyType.INT.intValue()) << 24) | (1337L << 28));
property.addPropertyBlock(block);
tx.create(node);
tx.create(property);
}
});
createNodePropertyExistenceConstraint(draconian, mandatory);
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportNodeDynamicLabelContainingDuplicateLabelAsNodeInconsistency.
@Test
public void shouldReportNodeDynamicLabelContainingDuplicateLabelAsNodeInconsistency() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
tx.nodeLabel(42, "Label");
NodeRecord nodeRecord = new NodeRecord(next.node(), false, -1, -1);
DynamicRecord record = inUse(new DynamicRecord(next.nodeLabel()));
Collection<DynamicRecord> newRecords = new ArrayList<>();
allocateFromNumbers(newRecords, prependNodeId(nodeRecord.getId(), new long[] { 42L, 42L }), new ReusableRecordsAllocator(60, record));
nodeRecord.setLabelField(dynamicPointer(newRecords), newRecords);
tx.create(nodeRecord);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE, 1).verify(RecordType.COUNTS, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportIfSomeKeysAreMissing.
@Test
public void shouldReportIfSomeKeysAreMissing() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
tx.incrementNodeCount(label3, -1);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.COUNTS, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportNodeInconsistencies.
@Test
public void shouldReportNodeInconsistencies() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
tx.create(new NodeRecord(next.node(), false, next.relationship(), -1));
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportDuplicatedRelationshipPropertyExistenceConstraintRules.
@Test
public void shouldReportDuplicatedRelationshipPropertyExistenceConstraintRules() throws Exception {
// Given
int relTypeId = createRelType();
int propertyKeyId = createPropertyKey();
createRelationshipPropertyExistenceConstraint(relTypeId, propertyKeyId);
createRelationshipPropertyExistenceConstraint(relTypeId, propertyKeyId);
// When
ConsistencySummaryStatistics stats = check();
// Then
on(stats).verify(RecordType.SCHEMA, 1).andThatsAllFolks();
}
Aggregations