use of org.neo4j.annotations.documented.ReporterFactory in project neo4j by neo4j.
the class LuceneIndexAccessorTest method indexReportInconsistencyToVisitor.
@Test
void indexReportInconsistencyToVisitor() {
when(schemaIndex.isValid()).thenReturn(false);
MutableBoolean called = new MutableBoolean();
final InvocationHandler handler = (proxy, method, args) -> {
called.setTrue();
return null;
};
assertFalse(accessor.consistencyCheck(new ReporterFactory(handler), NULL), "Expected index to be inconsistent");
assertTrue(called.booleanValue(), "Expected visitor to be called");
}
use of org.neo4j.annotations.documented.ReporterFactory in project neo4j by neo4j.
the class RecoveryIT method idGeneratorIsDirty.
private boolean idGeneratorIsDirty(Path path, IdType idType) throws IOException {
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fileSystem, immediate(), "my db");
try (IdGenerator idGenerator = idGeneratorFactory.open(pageCache, path, idType, () -> 0L, /*will not be used*/
10_000, readOnly(), Config.defaults(), NULL, Sets.immutable.empty())) {
MutableBoolean dirtyOnStartup = new MutableBoolean();
InvocationHandler invocationHandler = (proxy, method, args) -> {
if (method.getName().equals("dirtyOnStartup")) {
dirtyOnStartup.setTrue();
}
return null;
};
ReporterFactory reporterFactory = new ReporterFactory(invocationHandler);
idGenerator.consistencyCheck(reporterFactory, NULL);
return dirtyOnStartup.booleanValue();
}
}
use of org.neo4j.annotations.documented.ReporterFactory in project neo4j by neo4j.
the class FullCheck method consistencyCheckSchemaIndexes.
private static void consistencyCheckSchemaIndexes(IndexAccessors indexes, InconsistencyReport report, ProgressListener listener, CursorContext cursorContext) {
List<IndexDescriptor> rulesToRemove = new ArrayList<>();
for (IndexDescriptor onlineRule : indexes.onlineRules()) {
ConsistencyReporter.FormattingDocumentedHandler handler = ConsistencyReporter.formattingHandler(report, RecordType.INDEX);
ReporterFactory reporterFactory = new ReporterFactory(handler);
IndexAccessor accessor = indexes.accessorFor(onlineRule);
if (!accessor.consistencyCheck(reporterFactory, cursorContext)) {
rulesToRemove.add(onlineRule);
}
handler.updateSummary();
listener.add(1);
}
for (IndexDescriptor toRemove : rulesToRemove) {
indexes.remove(toRemove);
}
}
use of org.neo4j.annotations.documented.ReporterFactory in project neo4j by neo4j.
the class FullCheck method consistencyCheckSingleCheckable.
private static void consistencyCheckSingleCheckable(InconsistencyReport report, ProgressListener listener, ConsistencyCheckable checkable, RecordType recordType, CursorContext cursorContext) {
ConsistencyReporter.FormattingDocumentedHandler handler = ConsistencyReporter.formattingHandler(report, recordType);
ReporterFactory proxyFactory = new ReporterFactory(handler);
checkable.consistencyCheck(proxyFactory, cursorContext);
handler.updateSummary();
listener.add(1);
}
Aggregations