use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportMissingMandatoryRelationshipProperty.
@Test
public void shouldReportMissingMandatoryRelationshipProperty() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
long nodeId1 = next.node();
long nodeId2 = next.node();
long relId = next.relationship();
long propId = next.property();
NodeRecord node1 = new NodeRecord(nodeId1, true, false, relId, NO_NEXT_PROPERTY.intValue(), NO_LABELS_FIELD.intValue());
NodeRecord node2 = new NodeRecord(nodeId2, true, false, relId, NO_NEXT_PROPERTY.intValue(), NO_LABELS_FIELD.intValue());
// structurally correct, but does not have the 'mandatory' property with the 'M' rel type
RelationshipRecord relationship = new RelationshipRecord(relId, true, nodeId1, nodeId2, M, NO_PREV_RELATIONSHIP.intValue(), NO_NEXT_RELATIONSHIP.intValue(), NO_PREV_RELATIONSHIP.intValue(), NO_NEXT_RELATIONSHIP.intValue(), true, true);
relationship.setNextProp(propId);
PropertyRecord property = new PropertyRecord(propId, relationship);
property.setInUse(true);
PropertyBlock block = new PropertyBlock();
block.setSingleBlock(key | (((long) PropertyType.INT.intValue()) << 24) | (1337L << 28));
property.addPropertyBlock(block);
tx.create(node1);
tx.create(node2);
tx.create(relationship);
tx.create(property);
tx.incrementRelationshipCount(ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL, 1);
tx.incrementRelationshipCount(ANY_LABEL, M, ANY_LABEL, 1);
}
});
createRelationshipPropertyExistenceConstraint(M, mandatory);
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.RELATIONSHIP, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldNotReportAnythingForNodeWithConsistentChainOfDynamicRecordsWithLabels.
@Test
public void shouldNotReportAnythingForNodeWithConsistentChainOfDynamicRecordsWithLabels() throws Exception {
// given
assertEquals(3, chainOfDynamicRecordsWithLabelsForANode(130).first().size());
// when
ConsistencySummaryStatistics stats = check();
// then
assertTrue("should be consistent", stats.isConsistent());
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportRelationshipGroupRelationshipNotInUseInconsistencies.
@Test
public void shouldReportRelationshipGroupRelationshipNotInUseInconsistencies() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
long node = next.node();
long groupId = next.relationshipGroup();
long rel = next.relationship();
tx.create(inUse(new NodeRecord(node, true, groupId, NO_NEXT_PROPERTY.intValue())));
tx.create(withOwner(withRelationships(inUse(new RelationshipGroupRecord(groupId, C)), rel, rel, rel), node));
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.RELATIONSHIP_GROUP, 3).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportInvalidRelTypeIdInRelationshipPropertyExistenceConstraintRule.
@Test
public void shouldReportInvalidRelTypeIdInRelationshipPropertyExistenceConstraintRule() throws Exception {
// Given
int relTypeId = fixture.idGenerator().relationshipType();
int propertyKeyId = createPropertyKey();
createRelationshipPropertyExistenceConstraint(relTypeId, 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 shouldReportNothingForUniquenessAndPropertyExistenceConstraintOnSameLabelAndProperty.
@Test
public void shouldReportNothingForUniquenessAndPropertyExistenceConstraintOnSameLabelAndProperty() throws Exception {
// Given
int labelId = createLabel();
int propertyKeyId = createPropertyKey();
createUniquenessConstraintRule(labelId, propertyKeyId);
createNodePropertyExistenceConstraint(labelId, propertyKeyId);
// When
ConsistencySummaryStatistics stats = check();
// Then
assertTrue(stats.isConsistent());
}
Aggregations