use of org.neo4j.monitoring.DatabaseHealth in project neo4j by neo4j.
the class LogFilesBuilderTest method buildDefaultContextWithDependencies.
@Test
void buildDefaultContextWithDependencies() throws IOException {
SimpleLogVersionRepository logVersionRepository = new SimpleLogVersionRepository(2);
SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore();
DatabaseHealth databaseHealth = new DatabaseHealth(PanicEventGenerator.NO_OP, NullLog.getInstance());
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(logVersionRepository);
dependencies.satisfyDependency(transactionIdStore);
dependencies.satisfyDependency(databaseHealth);
TransactionLogFilesContext context = builder(databaseLayout, fileSystem).withDependencies(dependencies).withLogEntryReader(logEntryReader()).buildContext();
assertEquals(fileSystem, context.getFileSystem());
assertNotNull(context.getLogEntryReader());
assertEquals(ByteUnit.mebiBytes(250), context.getRotationThreshold().get());
assertEquals(databaseHealth, context.getDatabaseHealth());
assertEquals(1, context.getLastCommittedTransactionId());
assertEquals(2, context.getLogVersionRepository().getCurrentLogVersion());
}
use of org.neo4j.monitoring.DatabaseHealth in project neo4j by neo4j.
the class RecordStorageEngineTest method panicOnExceptionDuringCommandsApply.
@Test
void panicOnExceptionDuringCommandsApply() {
IllegalStateException failure = new IllegalStateException("Too many open files");
RecordStorageEngine engine = storageEngineRule.getWith(fs, pageCache, databaseLayout).databaseHealth(databaseHealth).transactionApplierTransformer(facade -> transactionApplierFacadeTransformer(facade, failure)).build();
CommandsToApply commandsToApply = mock(CommandsToApply.class);
var exception = assertThrows(Exception.class, () -> engine.apply(commandsToApply, TransactionApplicationMode.INTERNAL));
assertSame(failure, getRootCause(exception));
verify(databaseHealth).panic(any(Throwable.class));
}
Aggregations