use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldNotReportRelationshipGroupInconsistenciesForConsistentRecords.
@Test
public void shouldNotReportRelationshipGroupInconsistenciesForConsistentRecords() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
/* Create a little mini consistent structure:
*
* nodeA --> groupA -[next]-> groupB
* ^ |
* \ [out]
* \ v
* [start]- rel -[end]-> nodeB
*/
long nodeA = next.node();
long nodeB = next.node();
long rel = next.relationship();
long groupA = next.relationshipGroup();
long groupB = next.relationshipGroup();
tx.create(new NodeRecord(nodeA, true, groupA, NO_NEXT_PROPERTY.intValue()));
tx.create(new NodeRecord(nodeB, false, rel, NO_NEXT_PROPERTY.intValue()));
tx.create(firstInChains(new RelationshipRecord(rel, nodeA, nodeB, C), 1));
tx.incrementRelationshipCount(ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL, 1);
tx.incrementRelationshipCount(ANY_LABEL, C, ANY_LABEL, 1);
tx.create(withOwner(withRelationship(withNext(new RelationshipGroupRecord(groupA, C), groupB), Direction.OUTGOING, rel), nodeA));
tx.create(withOwner(new RelationshipGroupRecord(groupB, T), nodeA));
}
});
// 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 shouldReportBrokenSchemaRecordChain.
@Test
public void shouldReportBrokenSchemaRecordChain() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
DynamicRecord schema = new DynamicRecord(next.schema());
DynamicRecord schemaBefore = schema.clone();
// Point to a record that isn't in use.
schema.setNextBlock(next.schema());
IndexRule rule = indexRule(schema.getId(), label1, key, DESCRIPTOR);
schema.setData(rule.serialize());
tx.createSchema(asList(schemaBefore), asList(schema), rule);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.SCHEMA, 3).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportRelationshipGroupOwnerNotInUse.
@Test
public void shouldReportRelationshipGroupOwnerNotInUse() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
// group -[owner]-> <not-in-use node>
long node = next.node();
long group = next.relationshipGroup();
tx.create(withOwner(inUse(new RelationshipGroupRecord(group, C)), node));
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.RELATIONSHIP_GROUP, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportInvalidLabelIdInIndexRule.
@Test
public void shouldReportInvalidLabelIdInIndexRule() throws Exception {
// Given
int labelId = fixture.idGenerator().label();
int propertyKeyId = createPropertyKey();
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 shouldReportStringPropertyInconsistencies.
@Test
public void shouldReportStringPropertyInconsistencies() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
DynamicRecord string = new DynamicRecord(next.stringProperty());
string.setInUse(true);
string.setCreated();
string.setType(PropertyType.STRING.intValue());
string.setNextBlock(next.stringProperty());
string.setData(UTF8.encode("hello world"));
PropertyBlock block = new PropertyBlock();
block.setSingleBlock((((long) PropertyType.STRING.intValue()) << 24) | (string.getId() << 28));
block.addValueRecord(string);
PropertyRecord property = new PropertyRecord(next.property());
property.addPropertyBlock(block);
tx.create(property);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.STRING_PROPERTY, 1).andThatsAllFolks();
}
Aggregations